| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 2 초 | 1024 MB | 39 | 24 | 18 | 62.069% |
The members of the No-Weather-too-Extreme Recreational Climbing society completed their first successful summit seven years ago to this day!
At the time, we took a picture of all the members standing together in one row. However, the photograph looks messy, as the climbers were not standing in order of height, and we have no way to reorder them.
We will need to cut some of the climbers out of the picture.
Figure E.1: This picture of 7 (formerly 11) climbers was edited to solve Sample Input 3.
An optimal solution minimises the size and number of visible gaps in the photo. We define the cost as the sum of the squares of the lengths of gaps left in the edited photo. For example, if two individual climbers are removed from the photo and one pair of adjacent climbers are removed, the total cost is 1ドル^2 + 1^2 + 2^2 = 6$.
Find the minimum possible cost you can reach by removing climbers.
Output the minimum cost achieved by removing climbers from the photo, such that the remaining climbers in the photo make a non-decreasing sequence.
7 1 2 3 0 5 6 7
1
9 4 5 6 4 2 3 6 6 6
8
11 3 6 12 7 7 7 6 8 10 5 5
6
ICPC > Regionals > Europe > Northwestern European Regional Contest > The UK & Ireland Programming Contest > UKIEPC 2024 E번