Sabotage
Time limit1sMemory limit128 MB
Remove a contiguous block of middle machines, keeping the first and last, so the average output of the machines left is as small as possible.
- Level
Medium6 of 10
- Topics
- Binary search, Prefix sum
- Solved
- No attempts yet
Problem
Farmer Paul's plan is to disconnect a contiguous block of milking machines, but not the first or the last one.
There are machines in a row. Machine produces units of milk (, ). Paul may remove machines through with . He must remove at least one machine. After removal, what is the minimum possible average production of the machines that remain?
Farmer John wants that minimum average if Paul's plot succeeds.
Input
Line 1 contains the integer .
The next lines each contain for machine .
Output
Print the minimum achievable average, rounded to three digits after the decimal point, with exactly three digits after the decimal point.