cswork / OA打开练习工作台

IBMOA #50

Maximize Minimum Distance

估计中等可在线判题

考点(AI 标注)二分查找贪心调度

From n distinct points on the x axis, choose k so that the minimum distance between any two chosen points is as large as possible, and output that maximum value.

输入格式

The first line contains n k, and the second line contains the coordinates. 2≤n≤100000, 0≤coordinate≤10^9 with all coordinates distinct, 2≤k≤n.

输出格式

Output one integer, the answer.

样例 1

输入:

5 3
1 4 2 9 8

输出:

3

样例 2

输入:

2 2
0 10

输出:

10

样例 3

输入:

3 3
1 2 3

输出:

1

样例说明

The examples give 3, 10 and 1 respectively.