← All problemsSign in

Quick Exit

CodeChefRating 2475Open on judge ↗

**This problem has the same setup and constraints as QUICKEXIT. The only difference is that in this version, you only need to compute the minimum time.** You're given a tree with $N$ vertices rooted at vertex $1$. One person stands at each vertex, the strength of the person at vertex $i$ is denoted $P_i$. All strengths are between $1$ and $N$, and distinct. Repeat the following process while a

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