← All problemsSign in

Buying a car

A group of N cities is connected by one-way roads. Between each pair of cities there is exactly 1 road, and you are allowed to travel on it in only one direction. Lukas has decided to buy a car from one of these cities in such a way that it is possible to start from that city and reach any other city by travelling in his car. A very important factor in buying a car is the range of that car. The r

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