Illusion Tree
CodeChefOpen on judge ↗
Given a graph with $N$ nodes and $N - 1$ edges. Every node has value given by array $A$. Now you need to process queries of the following two types - * $1$ $V$ $X$ - Change the value of node $V$ to $X$ * $2$ $V$ $K$ - Find the sum of all values which occur **odd number of times** in path from vertex $V$ to its $K^{th}$ ancestor. If $K^{th}$ ancestor doesn't exist, take it $1$. **Not
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