Ticket 4816
Problem 1661 -c
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
6
5
2 2 3 4 3 
5
5 5 8 3 1 
9
5 9 4 3 1 2 4 7 1 
9
9 7 3 5 6 9 6 4 9 
1
8 
5
7 5 3 8 1 
Expected Output
4
12
30
16
0
11
Generator Parameters
--h_high 9 --h_low 1 --n_high 9 --n_low 1 --t_high 10 --t_low 1