#P7446. [Ynoi2007] rfplca
[Ynoi2007] rfplca
Problem Description
Given a rooted tree of size with node as the root. The tree is given in the following way: you are given , and it is guaranteed that . Add an edge between and to form a tree.
Then there are operations of two types:
1 l r xSet for all .2 u vQuery the LCA of and in the tree formed by the current array .
Input Format
The first line contains two integers and .
The next line contains integers, representing .
Then follow lines, each containing three or four integers, representing one operation.
This problem is forced online. All inputs must be XORed with , where is defined as the answer of the previous query operation. If there has been no query operation before, then it is .
Output Format
For each operation of type , output one line with one integer as the answer.
6 4
1 2 3 3 4
2 3 4
1 1 0 2
2 6 5
2 1 0
3
3
1
Hint
Idea: Ynoi, Solution: Ynoi, Code: Ynoi, Data: Ynoi&nzhtl1477
For of the testdata, it holds that , , , .
Translated by ChatGPT 5