#BS0000066. Sao chép sách (Copying Books)
Sao chép sách (Copying Books)
Copying Books
Source: UVa
Version: Phuoc Hung OJ Extended
Problem Statement
There are books in fixed order, with pages. Partition them into exactly non-empty contiguous groups, one per scribe. Minimize the maximum group sum. The PHOJ version asks only for this unique optimal value.
Input
The first line contains . The second line contains .
Output
Print the minimum possible maximum workload.
Subtasks
- Subtask 1 — 20%: .
- Subtask 2 — 30%: .
- Subtask 3 — 50%: , .
Example
Input
9 3
100 200 300 400 500 600 700 800 900
Output
1700
Explanation
An optimal partition has maximum group sum 1700.