Ticket 1489
Problem 1630 -d
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 3
2 2 2 -2 -3 2 
1 2 3 
2 1
0 3 
1 
Expected Output
13
3
Generator Parameters
--n_cap 1000000 --n_high 6 --n_low 2 --t_cap 100000 --t_high 2 --t_low 1 --val_cap 1000000000 --val_floor -1000000000 --val_high 3 --val_low -3