#P2166. Gty的超级妹子树【数据疑似有误】
Gty的超级妹子树【数据疑似有误】
Description
Maintain a rooted tree with initial nodes (the root is ). Nodes are labeled to , and each node has a weight . The tree may become a forest.
Support the following operations:
0 u xQuery the number of values strictly greater than in the subtree rooted at .1 u xSet the weight of node to .2 u xAdd a new node whose id is the current number of nodes plus , with parent and weight .3 uDelete the edge between and its parent, and make the root of its connected component.
This problem is strictly online.
All input must be XORed with to get the real input, where is the previous query’s answer, and initially .
Input Format
The first line contains a positive integer , the initial number of nodes.
The next lines each contain two integers , indicating an undirected edge in the tree.
The next line contains integers , the initial weight of each node.
The next line contains a positive integer , the number of operations.
The next lines each describe one operation, as specified above.
Output Format
For each operation with , output one line with a single integer, as described in the problem statement.
2
1 2
10 20
1
0 1 5
2
Hint
Constraints
For of the testdata, , , .
Translated by ChatGPT 5
京公网安备 11011102002149号