Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Mad Engineer Aksir

By jisan047 · 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

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.

constraints:

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

Output

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

Don't print any extra space.

Sample

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

Discussion

Statistics


71% Solution Ratio

bisnu_sarkarEarliest, Dec '19

ForkanFastest, 0.0s

Big_PappaLightest, 393 kB

fahmid07Shortest, 283B

Submit

Login to submit

Toph uses cookies. By continuing you agree to our Cookie Policy.