#P5892. [IOI 2014] holiday 假期
[IOI 2014] holiday 假期
Description
Jianjia is planning a trip to Taiwan for the next vacation. During this vacation, Jianjia will travel between cities and visit attractions in those cities.
There are cities in Taiwan, all located along a single highway. The cities are numbered consecutively from to .
For city (), its neighboring cities are and . For city , the only neighboring city is . For city , the only neighboring city is .
Each city has some attractions. Jianjia has days of vacation and wants to visit as many attractions as possible. He has already chosen the first city to visit at the start of the vacation. On each day of the vacation, Jianjia can either move to a neighboring city, or visit all attractions in the current city, but not both. Even if Jianjia stays in the same city multiple times, he will not visit the attractions of that city again. Please help Jianjia plan this vacation so that he can visit as many attractions as possible.
Input Format
- Line : Three non-negative integers, where is the number of cities, is the index of the starting city, and is the number of vacation days.
- Line : non-negative integers . For , is the number of attractions in city .
Output Format
- One line: the maximum number of attractions that can be visited.
5 2 7
10 2 20 30 1
60
Hint
Subtasks
In all subtasks, . Also, the number of attractions in each city is a non-negative integer.
| Subtask | Score | Maximum attractions in each city | Starting city | |
|---|---|---|---|---|
| No restriction | ||||
| City | ||||
| No restriction | ||||
Translated by ChatGPT 5
京公网安备 11011102002149号