#P9139. Copy
Copy
Source: Super League of Chinese College Students Algorithm Design 2022, Contest 2 by HDU.
Problem Description
Kayzin has a list of integers, initially the list is . He will execute operations.
For an operation of first type, he will select an interval , copy and insert it to the end of the interval.
For an operation of second type, he wonder the -th integer of the list.
You need to print the xor sum of all the answers of second type operations.
ps: What is xor? The xor value of two integers is equal to addition in binary without carry.
ps: is a constant for each test case.
Input
First line is an integer , indicating the number of test cases. For each test case:
First line is 2 integers , indicating the length of initial list and the number of operations.
Next line is integers , indicating the initial list.
Next line, one operation per line. The -th line could be 3 integers (), indicating the first type operation, or 2 integers (), indicating the second type operation.
the sum of the number of first type operations (all test cases together) not exceeds .
Output
For each test case, print one line, indicating the xor sum of the answers.
Sample
1
5 3
1 2 3 4 5
2 4
1 2 4
2 5
6
For first operation, the -th integer is .
For second operation, is copied, the list becomes .
For third operation, the -th integer is . So the result is .