#P18090. [UKIEPC 2026] Mid Clocking
[UKIEPC 2026] Mid Clocking
Problem Description
A row of slots can hold processors. Each processor handles only one task and enters a busy-wait state after completing it, waiting for the next instruction.
When a processor has no immediately adjacent processor on either side, it has sufficient cooling and can reach of its maximum speed. If it has immediately adjacent processor, it can reach only of its maximum speed. If it has immediately adjacent processors, it can reach only of its maximum speed.

Figure M.1: Illustration of Sample 2.
All tasks start at . Given the number of seconds each task requires when its processor runs at full speed, assign tasks to processors so that the last task finishes as early as possible.
Input Format
The input first gives the number of tasks and the number of processor slots ().
Then integers follow, representing the times required by the tasks when their processors run at of their maximum speed (), in seconds.
Output Format
Output the minimum time required to complete all tasks.
The absolute or relative error of your output must not exceed .
4 5
1 1000 1 1
1000
7 10
5 2 3 5 4 6 7
8.33333333
Hint
Translated by QwenWork