Ticket 1356
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
7 4
5 6 3 3 6 8 9 
4 2 8 5 7 4 4 
6 6
5 3 2 7 5 4 
7 2 9 7 8 5 
Expected Output
38
44
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