Ticket 4647
Problem 1661 -e
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
5
11000
00000
11100
9
3 4
4 4
1 5
3 3
3 3
2 5
5 5
1 4
1 4
Expected Output
1
0
2
1
1
2
0
2
2
Generator Parameters
--n_high 15 --n_low 1 --q_high 9 --q_low 1