← All problemsSign in

Reservoir Attack

There are $N$ reservoirs and houses (not equally divided) which are numbered $1, … N$ and are connected with $(N-1)$ pipes. Each reservoir and house has a usage value (which cannot be 0) say $A$ i $(1 ≤ i ≤ N)$ such that - - $A$i $ \gt 0$ - Indicates that it is a reservoir. - $A$i $ \lt 0$ - Indicates that it is a house. You have to disconnect some number of pipes (can be 0) to stop the whole sy

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