#t418. 书的复制
书的复制
Copying Books
Problem Description
Most people's mistake is to let the people at the front copy as few pages as possible: if the first few people could be given no books, one might output 0 0 for them. The test data has been adjusted so that everyone is guaranteed to have at least one book to copy.
You are given books with a fixed order and must distribute them to people to copy. Everyone copies at the same speed. A book may not be copied by two (or more) people, and the books assigned to any one person must be consecutive — for example, you cannot give book , book , and book to the same person.
Design a plan that minimizes the total copying time. The copying time is the time used by the person who copies the most pages.
Input Format
The first line contains two integers .
The second line contains integers; the -th integer is the number of pages in book .
Output Format
Output lines. Line contains two integers: the first and last book numbers copied by person . The starting book numbers across the lines must be in increasing order. If several answers exist, give as few pages as possible to the people at the front.
Sample Input
9 3
1 2 3 4 5 6 7 8 9
Sample Output
1 5
6 7
8 9
Hint
.