Ticket 5377
Problem 1668 -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
8
1 3
14 14
19 14
12 13
14 8
6 6
2 11
10 18
Expected Output
-1
26
35
23
26
10
19
34
Generator Parameters
--row_or_col_high 20 --row_or_col_low 1 --t_high 10 --t_low 1