#P2511. [HAOI2008] 木棍分割
[HAOI2008] 木棍分割
Description
There are sticks. The length of the -th stick is . The sticks are connected in the order of their indices (that is, the leftmost is the -st stick, then the -nd stick, and so on). There are joints in total. You are allowed to cut at most joints. After cutting, the sticks are divided into several segments. The requirement is to minimize the length of the longest segment.
Output the minimum possible value of the length of the longest segment, and the remainder of the number of schemes that achieve this minimum when divided by .
Input Format
The first line contains two positive integers .
The next lines each contain a positive integer , representing the length of the -th stick.
Output Format
Output integers: the minimum possible value of the length of the longest segment, and the remainder of the number of schemes that achieve this minimum when divided by .
3 2
1
1
10
10 2
Hint
Sample Explanation
You can cut once to split into two parts of total lengths and , or cut twice to split into three parts of total lengths , , and .
Constraints
For all testdata, $n \le 50000,\ 0 \le m \le \min(n-1, 1000),\ 1 \le L_i \le 1000$.
Translated by ChatGPT 5
京公网安备 11011102002149号