← All problemsSign in

Moonwalk

CodeChefRating 3090Open on judge ↗

Heinz has recently learnt to moonwalk! Now he wants to practice it in the central park. We know that Danville's central park consists of $N$ junctions (numbered $1$ through $N$) and that $M$ pairs of these junctions are connected by one-way roads (numbered $1$ through $M$). First, Heinz picks a junction he starts from. Then, he alternately performs the following actions, starting with walking:

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