← All problemsSign in

Subtree Queries

Problem description A rooted tree with N nodes is given. Every node has some parent and there is only 1 node which has no parent and it is the root of the tree. Every node also has some value associated with it (honesty value). Every edge in the tree is equal to 1 unit distance. You will be given Q queries of two types, provided with three values: type, nd, and k :. - type = 1 : Answer the numb

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.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start