#abc370f. F - Cake Division
F - Cake Division
Score : points
问题陈述
有一个圆形蛋糕被切线分成了 块。每条切线是连接圆心到圆弧上某点的线段。
这些块和切线按顺时针方向编号为 ,并且块 的质量为 。块 也被称为块 。
切线 位于块 和块 之间,它们按顺时针顺序排列:块 ,切线 ,块 ,切线 ,,块 ,切线 。
我们希望在以下条件下将这个蛋糕分给 个人。设 为第 个人收到的块的质量之和。
- 每个人收到一个或多个连续的块。
- 没有块是没有人收到的。
- 在上述两个条件下, 被最大化。
找出满足条件的分割中 的值,以及在满足条件的分割中从未被切割的切线数量。在这里,如果块 和块 被分给不同的人,则认为切线 被切割。
以上为大语言模型 kimi 翻译,仅供参考。
Problem Statement
There is a circular cake divided into pieces by cut lines. Each cut line is a line segment connecting the center of the circle to a point on the arc.
The pieces and cut lines are numbered in clockwise order, and piece has a mass of . Piece is also called piece .
Cut line is between pieces and , and they are arranged clockwise in this order: piece , cut line , piece , cut line , , piece , cut line .
We want to divide this cake among people under the following conditions. Let be the sum of the masses of the pieces received by the -th person.
- Each person receives one or more consecutive pieces.
- There are no pieces that no one receives.
- Under the above two conditions, is maximized.
Find the value of in a division that satisfies the conditions, and the number of cut lines that are never cut in the divisions that satisfy the conditions. Here, cut line is considered cut if pieces and are given to different people.
Constraints
- All input values are integers.
Input
The input is given from Standard Input in the following format:
Output
Let be the value of in a division that satisfies the conditions, and be the number of cut lines that are never cut. Print and in this order, separated by a space.
Sample Input 1
5 2
3 6 8 6 4
Sample Output 1
13 1
The following divisions satisfy the conditions:
- Give pieces to one person and pieces to the other. Pieces have a total mass of , and pieces have a total mass of .
- Give pieces to one person and pieces to the other. Pieces have a total mass of , and pieces have a total mass of .
The value of in divisions satisfying the conditions is , and there is one cut line that is not cut in either division: cut line .
Sample Input 2
6 3
4 7 11 3 9 2
Sample Output 2
11 1
Sample Input 3
10 3
2 9 8 1 7 9 1 3 5 8
Sample Output 3
17 4