← All problemsSign in

Two-lane Road

CodeChefRating 2489Open on judge ↗

Chef works as a cook in a restaurant. Each morning, he has to drive down a straight road with length $K$ to reach the restaurant from his home. Let's describe this road using a coordinate $X$; the position of Chef's home is $X = 0$ and the position of the restaurant is $X = K$. The road has exactly two lanes (numbered $1$ and $2$), but there are $N$ obstacles (numbered $1$ through $N$) on it. For

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