#K90587. Minimize Maximum Delivery Time
Minimize Maximum Delivery Time
Minimize Maximum Delivery Time
You are given M drivers and a sequence of delivery times. The objective is to partition the delivery times into exactly M contiguous segments such that the maximum sum of any segment is minimized. In other words, if you denote a partition of the delivery times into segments and each segment's sum as S, then you wish to minimize the quantity:
$$\min\;\max_{1 \leq i \leq M} \; S_i$$
This is equivalent to the classic Split Array Largest Sum problem. Your program should read the input from stdin
and output the result to stdout
.
inputFormat
The first line of input contains two integers M
and N
separated by a space, where M
is the number of drivers and N
is the number of deliveries.
The second line contains N
space-separated positive integers representing the delivery times.
outputFormat
Output a single integer representing the minimized maximum delivery time required when partitioning the deliveries among the drivers.
## sample3 5
1 2 3 4 5
6
</p>