Cursed
Ravi has a [tree](https://en.wikipedia.org/wiki/Tree_(graph_theory)) with $N$ nodes, with its root being node $1$. The $i$-th node of this tree has $P_i$ points. Ravi is initially standing on node $1$ of this tree. He'd like to visit several nodes of this tree and collect points. To do this, he can move through the edges of the tree. That is, if Ravi is standing on a node $u$, he can pick a nei
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