Ticket 14970
Problem 1674 -f
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
7 5 9
*****
....*
..*.*
***.*
*..*.
***..
*.*..
3 1
2 4
4 4
1 3
4 3
1 2
1 4
1 3
2 3
Expected Output
7
7
7
8
9
10
9
9
8
Generator Parameters
--q_high 9 --q_low 1 --row_or_col_high 9 --row_or_col_low 1