#agc056c. [agc056_c]01 Balanced
[agc056_c]01 Balanced
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.
Sample Input 1
4 2
1 2
3 4
Sample Output 1
0101
Sample Input 2
6 2
1 4
3 6
Sample Output 2
001100
Sample Input 3
20 10
6 17
2 3
14 19
5 14
10 15
7 20
10 19
3 20
6 9
7 12
Sample Output 3
00100100101101001011