Token Passing on Tree
You are given a directed tree $T$ containing $N$ vertices, rooted at vertex $1$. Each edge of the tree is directed from parent to child. The $i$-th node initially contains a single token with label $i$. In one operation you do the following: - Select **any** edge of $T$, call it $e\:=\:u\:\rightarrow\:v$. - Move **all** tokens accumulated on $u$ till now to $v$. - Delete $e$ from $T$. You per
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