Unreachability Cost
The country of Chefland has $N$ cities and $M$ **unidirectional** roads between these cities. You plan to visit Chefland as a tourist, but you haven't yet decided which cities to visit or what your budget will be. However, you do know that you'd like to use the roads as much as possible. Let's call a pair of cities $(u, v)$ *disconnected*, if either there is no path from city $u$ to city $v$ u
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.
Sign in to chat with the tutor and save your progress.
Sign in to start