Stan Lee and Avengers
CodeChefOpen on judge ↗
The world is in danger. To save the world Stan Lee decided to create an army of $N$ avengers and placed them at various places across the globe. The avengers are connected to each other in the form of a connected undirected tree. Initially all of them has $0$ energy. To increase the energy of the army, Stan Lee devised a strategy. He drops a tonic of energy $x$ to $i_{th}$ avenger who has to tr
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