← All problemsSign in

Where Is the Root

CodeChefRating 3145Open on judge ↗

*This is an interactive problem*. You are given a tree of $n$ vertices. The tree is a graph such that there is exactly one simple path between every pair of vertices. **It's also guaranteed that at least one vertex is directly connected by an edge to at least 3 vertices.** One of the vertices is the root, and your task is to find it. In order to do this, you are allowed to ask queries of the foll

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