House of Queries
CodeChefOpen on judge ↗
You are given a connected tree rooted at **$1$**. Each node has an integer value **$A$i** associated with it. You need to process **$Q$** queries. The queries can be of the following two types :- Type1 : **`1 X Y`**, Change the value at node $X$ to $Y$, i.e. **$A$X$ = Y$**. Type2 : **`2 X D`**, Output the sum of all nodes at a distance $D$ from node $X$ which are in the subtree of $X$. If ther
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