Naruto Run Extended
CodeChefOpen on judge ↗
Naruto is done visiting all the villages. It turns out that this was a secret mission to collect data that might be useful. Naruto found out that each village belongs to a group $G$. Let's define $G_i$ as the group to which the $i^{th}$ village belongs. As we already know, The whole network of villages is in the form of a rooted tree, where each village represents a vertex, with village $1$ being
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