← All problemsSign in

All Roads Lead To Rome

CodeChefRating 2676Open on judge ↗

The country of Chefland is a group of $N$ cities having $M$ directed roads between its cities. It takes $1$ second to travel on any road. Chef has decided to travel through this country. His travel plan goes as follows - - He will randomly choose a starting city. - While there are outgoing roads in his current city, he will randomly choose one of them and travel it. He can choose roads he has

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