#P2137. Gty的妹子树
Gty的妹子树
Description
Maintain a rooted tree with nodes initially (the root is ), with node labels , and each node has a weight .
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 node whose index is "current number of nodes in the tree + 1", with parent and weight .
This problem is strictly online.
All input must be XORed with to obtain the actual input.
Here is the answer to the previous query, with initial .
Input Format
The first line contains a positive integer , the initial number of nodes.
The next lines each contain two integers , representing 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 contain three integers , describing one operation.
Output Format
For each operation with , output one line containing an integer, as described above.
2
1 2
10 20
1
0 1 5
2
2
1 2
10 20
1
0 1 10
1
Hint
Constraints
For of the testdata, , , .
Translated by ChatGPT 5
京公网安备 11011102002149号