luogu#P12076. [OOI 2025] Cute Subsequences
[OOI 2025] Cute Subsequences
题目描述
You are given an array of positive integers , , , , as well as a positive integer . You need to divide the array into non-empty subsequences such that each element of the array belongs to exactly one subsequence. A subsequence is a sequence that can be obtained from another sequence by deleting some elements without changing the order of the remaining elements.
Let the -th subsequence contain elements with indices . The of this subsequence is defined as the maximum value of for all from to .
The of dividing the array into subsequences is the sum of the of these subsequences.
Find the maximum of the division.
输入格式
The first line contains two positive integers and () --- the size of the array and the number of subsequences to divide it into.
The second line contains positive integers , , , () --- the elements of the array.
输出格式
Output the maximum of dividing the given array into non-empty subsequences.
5 3
3 7 10 1 2
24
提示
Note
In the sample test, the array can be divided into , , . Then the answer will be .
Scoring
The tests for this problem consist of six groups. Points for each group are given only if all tests of the group and all tests of the required groups are passed.
Group | Points | Additional Constraints: | Additional Constraints: | Required Groups | Comment |
---|---|---|---|---|---|
0 | -- | -- | -- | Examples. | |
1 | 14 | 0 | |||
2 | 19 | -- | -- | ||
3 | 17 | -- | |||
4 | 21 | ||||
5 | 15 | 0, 1 | |||
6 | 14 | -- | 0 -- 5 |