#P3853. [TJOI2007] 路标设置

    ID: 2769 远端评测题 1000ms 128MiB 尝试: 0 已通过: 0 难度: 5 上传者: 标签>模拟搜索2007二分各省省选天津

[TJOI2007] 路标设置

Description

Now the government plans to add some signposts on the highway to minimize the highway’s "emptiness index". They ask you to design a program to compute the minimum achievable value. Note that the start and the end of the highway are guaranteed to already have signposts, the highway length is an integer, and both existing and newly added signposts must be at integer distances from the start.

Input Format

The first line contains three integers L,N,KL,N,K, representing the highway length, the number of existing signposts, and the maximum number of signposts that can be added, respectively.

The second line contains NN integers in increasing order, representing the positions of the existing NN signposts. Each position is the distance from the start and lies within the interval [0,L][0,L].

Output Format

Output one line containing a single integer, the minimum "emptiness index" achievable after adding signposts.

101 2 1
0 101
51

Hint

Originally, the highway had only two signposts at the start and the end. Now you are allowed to add one signpost. You should place the new signpost at a distance of 5050 or 5151 from the start, which yields the minimum emptiness index of 5151.

Constraints:

  • In 50%50\% of the testdata, 2N1002 \leq N \leq 100, 0K1000 \leq K \leq 100.
  • In 100%100\% of the testdata, 2N1000002 \leq N \leq 100000, 0K1000000 \leq K \leq 100000.
  • In 100%100\% of the testdata, 0<L100000000 < L \leq 10000000.

Translated by ChatGPT 5