← All problemsSign in

Saul and Tree

Walter wants Saul to help him in clearing out his name as a criminal, but Saul is asking Walter to play a game first. The game proceeds as follows. Given an empty tree with a single node $1$ in it. Any further edges added in this tree have a property represented using a pair of two integers $\{a,b\}$. Process $Q$ queries on it with each one being in one of the following formats: - $1\ p\ a\ b$. I

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