Limits 1s, 512 MB

Can you imagine? Mad Engineer Aksir finally got the job. His job is to set up toggle switch for a series of electric bulbs which are numbered from 1 to N. He finally did the work in some peculiar manner that is, for a switch it toggles all the bulbs from L to R.
More formally suppose, a switch toggles the bulbs from 2 to 6 it means the switch will check each bulb numbered from 2 to 6 and will make it ON if it is OFF now and make it OFF if it is ON now.

Now you have something to do. For your kind information initially the all the bulbs are OFF and represent with 0. That is 1 represent ON and 0 represent OFF. You have to tell whether the bulb is ON or OFF for each bulb.


Input starts with N and Q representing the number of bulbs and the number of the switch.
In the next Q lines, there will be given Li, Ri Representing it will toggle all the bulbs from Li to Ri, If ith switch is pressed.


1 <= N, Q <= 100000
1 <= L <= R <= N


Print N integer (0 or 1) denoting that ith switch is ON or OFF.

Don't print any extra space.


5 3
1 5
1 3
3 5
0 0 1 0 0


Login to submit.


73% Solution Ratio
bisnu_sarkarEarliest, Dec '19
mash27Fastest, 0.0s
mash27Lightest, 5.5 kB
fahmid07Shortest, 283B
Toph uses cookies. By continuing you agree to our Cookie Policy.