시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
2 초 | 1024 MB | 64 | 35 | 34 | 70.833% |
Cookie Run game is a popular game in which the cookie character runs through a map consisting of N stages to score points.
Soo Young, the map designer for Cookie Run, was preparing a new map patch for Children's Day. After working hard to create an attractive map and testing it for the last time the day before the patch, she suddenly realized that the map was designed to be too easy!
The map design of the cookie run game consists of the following rules.
In other words, the following conditions should be satisfied:
To solve this problem, Soo Young requested help from KAIST RUN Spring Contest participants.
Since there is not much time left until the patch release, all Soo Young can do is add difficulty $X$ to all stages at once to make it more difficult.
Your job is to find the smallest non-negative integer $X$ that satisfies these conditions.
The first line contains three space-separated integers, $N$, $M$, and $K$.
The second line contains $N$ space-separated integers $A_{0}, A_{1}, \cdots, A_{N-1}$.
Print a single non-negative integer denoting the smallest possible $X$.
You can assume that at least one non-negative integer $X$ exists, satisfying the given conditions.
This subtask has additional constraints:
This subtask has additional constraints:
This subtask has an additional constraint:
This subtask has no additional constraints.
3 20 5 4 0 4
16
5 30 4 1 2 3 4 5
6
4 32 4 8 7 5 9
9