#P7442. 「EZEC-7」维护序列
「EZEC-7」维护序列
Description
You need to maintain a sequence.
At the beginning, the sequence has numbers, indexed starting from . The initial value of the -th number is . You need to support the following three operations:
- Define as the subsequence consisting of all elements whose indices are even, and define as the subsequence consisting of all elements whose indices are odd. Concatenate and to form a new sequence.
- Define as the subsequence consisting of all elements whose indices are odd, and define as the subsequence consisting of all elements whose indices are even. Concatenate and to form a new sequence.
- Query the number at index .
In total, there will be operations.
Input Format
The first line contains two positive integers .
Then there are lines. Each line contains two non-negative integers , representing one operation.
If , then if it means the first operation, and if it means the second operation.
If , it means the third operation, and the parameter is the queried index .
Output Format
For each , output one line, which is the corresponding number.
2 7
2 0
1 0
2 1
1 1
2 2
1 0
2 3
0
2
0
1
Hint
Sample Explanation
The sequence from left to right before and after all operations is as follows:
The number at index is .
The number at index is .
The number at index is .
The number at index is .
Constraints
This problem uses bundled testdata.
- Subtask 1 (10 points): There is no operation with .
- Subtask 2 (10 points): .
- Subtask 3 (20 points): .
- Subtask 4 (20 points): .
- Subtask 5 (20 points): For operations with , .
- Subtask 6 (20 points): No special restrictions.
For of the data, ,.
If , then . If , then .
Translated by ChatGPT 5
京公网安备 11011102002149号