Ticket 4525
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
01010
01100
00011
7
2 3
3 4
4 5
4 5
2 5
4 5
2 2
Expected Output
1
3
2
2
3
2
1
Generator Parameters
--n_high 15 --n_low 1 --q_high 9 --q_low 1