luogu#P2166. Gty的超级妹子树【数据疑似有误】
Gty的超级妹子树【数据疑似有误】
Background
I once met you among the green hills,
Leaning on a new bamboo staff, with purple cornels in your hair.
Barefoot, you stepped through the boundless drizzling rain,
Then picked up the drifting snowflakes of Yanchuan, falling like a mat...
Gty, the godlike (xian) bull (chong), never lacks girls...
He comes to a “girl tree” again and finds that each girl has a beauty value...
Since Gty is very zhe♂xue and very ji♂zhi, he is only interested in girls whose beauty value is greater than a certain threshold.
He wants to know the number of girls with beauty value greater than in a certain subtree.
A girl’s beauty value may change...
A new girl may appear on the tree...
However... a branch may break. Thus, to Gty’s surprise, what lies before him becomes a forest made of girl trees...
Problem 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