C. GOLD COINS

0

0 votes
Problem

Gold coins are located in a straight line, your task is to select Gold coins so that the minimum distance between the selected Gold coins is as large as possible.


Input
The first line contains numbers n (2≤n≤104), the number of Gold coins, and k (2≤k≤n), the number of coins to be selected. The second line contains n integer numbers in ascending order, the coordinates of the Gold coins  (coordinates are in the range from 0 to 109, inclusive).


Output
Print one number, the largest possible minimum distance between two Gold Coins.

Time Limit: 2
Memory Limit: 256
Source Limit:
Explanation

The Coordinates are 2 5 7 11 15 20.

one of the optimal way to select 3 Gold coin is to take Gold coin at index 1, 4,6(Indexing is 1-based)

 

Editor Image

?