Growing Xor Tree
CodeChefOpen on judge ↗
Given a graph with Node 1 with a certain weight **$W_1$**. You have to process 2 types of queries. - $1$ $P$ $W$ - $2$ $Z$ $W$ Type 1 query: $1$ $P$ $W$ Add a Node with index = (1 + no. of nodes in tree) with the Parent being $P$ and $W$ as its weight. Type 2 query: $2$ $Z$ $W$ Let there be a sequence of Nodes **$S_1$**,**$S_2$**,**$S_3$**,**$S_4$**...., that follows follo
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start