← All problemsSign in

Naruto Needs Help

Naruto will be given certain missions for which he will have to visit a particular village(target village). Obviously he will take the shortest path from his village (Village $1$). On his way to the target village, all the villages he visits (except his home village), he needs to pay some tax, even for the target village. Naruto knows the tax, $A_i$ for each village. However, the tax for any villa

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.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start