← All problemsSign in

King Killing

CodeChefRating 2568Open on judge ↗

In a faraway kingdom there are $N$ cities numbered $1$ to $N$ connected to each other in the form of a tree. The city numbered $1$ is the kingdom where the king resides. A city is called a leaf if it is not the kingdom and it has exactly one adjacent city. Each leaf city has an assassin. The enemies of the king have announced a huge reward for the assassination of the king. Each assassin starts

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