atcoder#AGC056C. [AGC056C] 01 Balanced
[AGC056C] 01 Balanced
Score : points
Problem Statement
Consider making a string of length consisting of 0
and 1
, where must satisfy conditions.
The -th condition is represented by integers and ().
This means that there should be equal numbers of 0
and 1
between the -th and -th characters (inclusive) of .
Find the lexicographically smallest string that satisfies all conditions. It can be proved that the Constraints of the problem guarantee the existence of that satisfies the conditions.
Constraints
- ()
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
4 2
1 2
3 4
0101
6 2
1 4
3 6
001100
20 10
6 17
2 3
14 19
5 14
10 15
7 20
10 19
3 20
6 9
7 12
00100100101101001011