#Q119. 「一本通 4.1 练习 2」简单题

「一本通 4.1 练习 2」简单题

Description

Source: CQOI 2006

There is an array of nn elements, each initially set to 00. There are mm instructions, each either flipping a continuous segment of numbers—changing 00 to 11 and 11 to 00 (Operation 11), or querying the value of a specific element (Operation 22).

For example, when n=20n=20, the 1010 instructions are as follows:

Operation Answer Array After Operation
1 1 101\ 1\ 10 N/A 1111111111000000000011111111110000000000
2 62\ 6 11 1111111111000000000011111\underline{1}11110000000000
2 122\ 12 00 1111111111000000000011111111110\underline{0}00000000
1 5 121\ 5\ 12 N/A 1111000000110000000011110000001100000000
2 62\ 6 00 1111000000110000000011110\underline{0}00001100000000
2 152\ 15 1111000000110000000011110000001100\underline 000000
1 6 161\ 6\ 16 N/A 11110111110011110000 11110111110011110000
1 11 171\ 11\ 17 1111011111110000100011110111111100001000
2 122\ 12 11 1111011111110000100011110111111\underline 100001000
2 62\ 6 1111011111110000100011110\underline 111111100001000

Input Format

The first line contains two integers nn and mm, representing the length of the array and the number of instructions, respectively.
The following mm lines each start with an integer tt indicating the type of operation:

  • If t=1t=1, it is followed by two integers LL and RR, indicating that each number in the interval [L,R][L, R] should be flipped;
  • If t=2t=2, it is followed by a single integer ii, representing the index to be queried.

Output Format

For each Operation 22, output a line (either 00 or 11), representing the answer to the query.

Sample 1

20 10
1 1 10
2 6
2 12
1 5 12
2 6
2 15
1 6 16
1 11 17
2 12
2 6

1
0
0
0
1
1

Constraints & Hints

For 50%50\% of the data, 1n103,1m1041\le n\le 10^3,1\le m\le 10^4;
For 100%100\% of the data, 1n105,1m5×1051\le n\le 10^5,1\le m\le 5\times 10^5, with LRL\le R guaranteed.