D - Pilgrims Destination
There is a planet named “Ruizland” having $N$ cities, These cities are connected in the form of a tree by a bidirectional path of specified length(in miles). Cities are numbered from $1$ to $N$. City number $1$ is the capital city. $M$ pilgrims started their journey from the capital city having initial energy $E_1, E_2, \ldots, E_M$ respectively which reduces on moving from one city to another by
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