Toll-ed
CodeChefOpen on judge ↗
There are $N$ cities in the country and they are connected by $N-1$ roads. Bank is situated at the root node which is node $1$. In this country, only $1$ person lives in each city except the city in which bank is situated. Each person wants to deposit $A_i$ amount in their account. They start their journey towards bank following the shortest path from their city. But they have to pay $t_i$ amou
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