← All problemsSign in

It is a tree

CodeChefRating 3205Open on judge ↗

*This problem has subtasks.* You are given a tree$^\dagger$ with $N$ vertices, **rooted at vertex $1$**. Each vertex of this tree will have either $0$ people, or $1$ person standing on it. Consider the following process on this tree: - Let $\text{score}_u$ denote the score of vertex $u$. Initially, this is $0$ for all vertices. - Every second, each person in the tree will *simultaneously* move o

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