Ticket 8606
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
7
0100001
1011011
1000000
9
4 7
5 5
1 2
3 4
6 7
3 4
2 5
1 7
1 3
Expected Output
2
0
2
1
1
1
2
4
3
Generator Parameters
--n_high 15 --n_low 1 --q_high 9 --q_low 1