#P6647. [CCC 2019] Tourism
[CCC 2019] Tourism
Background
Warning: Abusing this problem’s judging system will result in an account ban.
Shuchong and you are having fun visiting Luogu’s famous attractions.
But he stood you up because he is not good enough.
So you have to visit Luogu’s famous attractions by yourself.
Problem Description
You are visiting attractions, numbered from to . Due to the strict requirement of 3k, you must visit them in the order from to . You can visit at most attractions per day. Since you need to spend the remaining time on solving hard problems, you want to finish visiting these attractions as soon as possible.
Each attraction has a different level of attractiveness. The attractiveness of attraction is . The official rating for a day is the maximum among the attractions visited that day. In the end, you sum up the official ratings of all days to get the final score.
Because you are in a hurry to solve hard problems, you have already calculated the minimum number of days needed to visit all attractions (call it ). You want to know:
- Visit in days.
- Satisfy that you visit at most attractions per day.
- What is the maximum possible final score.
Input Format
The first line contains two integers , representing the number of attractions and the maximum number of attractions you can visit per day.
The second line contains integers , representing the attractiveness of each attraction.
Output Format
Output one integer on a single line, representing:
- Visit in days.
- Satisfy that you visit at most attractions per day.
- The maximum possible final score.
( is the minimum number of days needed to visit all attractions.)
5 3
2 5 7 1 4
12
Hint
Sample Explanation
For Sample :
- It is easy to see that at least days are needed to visit all attractions.
- But we cannot visit all attractions in one day ().
- If we split the attractions as evenly as possible, there are two cases:
- If we visit attractions on the first day and on the second day, the final score is .
- If we visit attractions on the first day and on the second day, the final score is .
- Therefore, the answer is .
Constraints and Notes
This problem uses bundled testdata.
- Subtask 1 (20 pts): .
- Subtask 2 (20 pts): , .
- Subtask 3 (60 pts): No additional constraints.
For of the testdata, , .
Notes
Translated from CCC 2019 Senior T4 Tourism.
Translator: @一只书虫仔。
Translated by ChatGPT 5