#P10909. [蓝桥杯 2024 国 B] 立定跳远
[蓝桥杯 2024 国 B] 立定跳远
Problem Description
At a sports meet, Xiaoming starts a standing long jump from the origin on the number line and jumps in the positive direction. The event has checkpoints , and . Xiaoming must jump to each checkpoint in order, and he can only land on checkpoints. Also, Xiaoming may add more checkpoints by himself to make the jumps easier.
Before the sports meet, Xiaoming makes a training plan so that the maximum distance of a single jump reaches , and he also learns a burst skill that can be used once during the event. When he uses it, the maximum distance for that jump becomes . Xiaoming wants to know: what is the minimum value of that allows him to complete the event?
Input Format
The input has lines.
The first line contains two positive integers .
The second line contains positive integers separated by spaces.
Output Format
Output line containing one integer, which is the answer.
5 3
1 3 5 16 21
3
Hint
[Sample Explanation]
Add checkpoints . Then the jump distances are . Use the skill on the third jump.
[Constraints]
For of the testdata, , , .
For of the testdata, , , .
Translated by ChatGPT 5