← All problemsSign in

Planning the Trip

CodeChefRating 3242Open on judge ↗

*Toad has been asked to plan the next trip in Mushroom World. To do this, he is required to solve the following problem, can you help him?* Given a tree with $N$ nodes, a [Depth-first search](https://en.wikipedia.org/wiki/Depth-first_search) function for it is defined below. ```cpp vector adj[N+1]; int tin[N+1]; int timer = 0; void DFS(int U, int P) { tin[U] = timer++; sort(adj[U].begin

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