Fair Reading Load
N books (page counts given) must be split among K students; each student reads a contiguous block, every book is read. Minimize the maximum pages any one student reads and print that value.
Input: the first line has N and K (K ≤ N); the second line has the page counts.
Output: the minimized maximum load.
Constraints:
- 1 ≤ K ≤ N ≤ 105
- 1 ≤ pagesi ≤ 104
Sample Tests
Input 1
4 2 12 34 67 90
Output 1
113
Input 2
2 2 5 5
Output 2
5
Discussion (opens after you solve — no spoilers before)
No comments yet.