Ticket 5496
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
9
9 2
1 14
19 19
8 14
10 18
10 15
16 15
6 6
19 1
Expected Output
15
-1
36
26
34
27
29
10
-1
Generator Parameters
--row_or_col_high 20 --row_or_col_low 1 --t_high 10 --t_low 1