← All problemsSign in

River Canals

A river contains integer amount of water in the range $\left[A, B\right]$, where all values between $A$ and $B$ (inclusive) are **equally probable**. There are $N$ canals connected to the river, numbered $0, 1, \ldots, N-2, N-1$ ,i.e. zero-indexed. Canal $i$ can take out $C_i$ amount of water from the river at once, $0 \leq i \leq N-1$. Starting from canal $i = 0$, the following operations are pe

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