#Q119. 「一本通 4.1 练习 2」简单题
「一本通 4.1 练习 2」简单题
Description
Source: CQOI 2006
There is an array of elements, each initially set to . There are instructions, each either flipping a continuous segment of numbers—changing to and to (Operation ), or querying the value of a specific element (Operation ).
For example, when , the instructions are as follows:
| Operation | Answer | Array After Operation |
|---|---|---|
| N/A | ||
| N/A | ||
| N/A | ||
Input Format
The first line contains two integers and , representing the length of the array and the number of instructions, respectively.
The following lines each start with an integer indicating the type of operation:
- If , it is followed by two integers and , indicating that each number in the interval should be flipped;
- If , it is followed by a single integer , representing the index to be queried.
Output Format
For each Operation , output a line (either or ), 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 of the data, ;
For of the data, , with guaranteed.