Ticket 1386
Problem 1629 -a
View hacks & all small testcases

Unable to dry run this testcase?
Try making a new request with small values of n_high, t_high, *_high, etc.


Retry
Input
2
6 7
2 6 7 2 2 5 
7 6 6 7 9 7 
3 4
4 3 2 
2 4 6 
Expected Output
49
16
Generator Parameters
--k_cap 1000 --k_high 9 --k_low 1 --n_cap 100 --n_high 9 --n_low 1 --t_cap 100 --t_high 2 --t_low 1 --val_cap 1000 --val_high 9 --val_low 1