#P2678. [NOIP 2015 提高组] 跳石头

[NOIP 2015 提高组] 跳石头

Description

The annual "Jumping Stones" competition is about to begin.

The competition takes place in a straight river channel where some huge rocks are distributed. The organizing committee has chosen two rocks as the start and the finish. Between the start and the finish, there are NN rocks (excluding the start and finish rocks). During the competition, participants start from the start rock and jump to an adjacent rock at each step until they reach the finish.

To increase the difficulty, the committee plans to remove some rocks so that the minimum jump distance during the competition is as large as possible. Due to budget limits, the committee can remove at most MM rocks between the start and the finish (the start and finish rocks cannot be removed).

Input Format

The first line contains three integers L,N,ML, N, M, representing the distance from the start to the finish, the number of rocks between the start and the finish, and the maximum number of rocks the committee may remove, respectively. It is guaranteed that L1L \geq 1 and NM0N \geq M \geq 0.

The next NN lines each contain one integer. On the ii-th line, the integer Di(0<Di<L)D_i\,(0 < D_i < L) denotes the distance from the start to the ii-th rock. These rocks are given in increasing order of distance from the start, and no two rocks are at the same position.

Output Format

Output a single integer, which is the maximum possible minimum jump distance.

25 5 2 
2
11
14
17 
21
4

Hint

Explanation for Sample Input/Output 1

After removing the two rocks at distances 22 and 1414 from the start, the minimum jump distance becomes 44 (either when jumping from the rock at distance 1717 to the rock at distance 2121, or from the rock at distance 2121 to the finish).

Constraints

  • For 20%20\% of the testdata, 0MN100 \le M \le N \le 10.
  • For 50%50\% of the testdata, 0MN1000 \le M \le N \le 100.
  • For 100%100\% of the testdata, 0MN500000 \le M \le N \le 50000, 1L1091 \le L \le 10^9.

Translated by ChatGPT 5