Water Everywhere
CodeChefOpen on judge ↗
There are $n$ cities and $m$ one-directional supply pipes going from one city to another. The governor can set up water supplying stations in any city $i$ after paying the installation cost for that city, $cost_i$. Having little education, he came to the conclusion that the most efficient system to get water to all cities would be to choose the cities such that the **number** of cities chosen is m
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