P17185 [ICPC 2017 Hong Kong R] Base Station Sites
Description
$5G$ is the proposed next telecommunications standards beyond the current $4G$ standards. $5G$ planning aims at higher capacity than current $4G$, allowing a higher density of mobile broadband users, and supporting device-to-device, reliable, and massive wireless communications. A telecommunication company would like to install more base stations to provide better communication for customers. Due to the installation cost and available locations, the company can only install $S$ ($2 \le S \le L$) base stations at $L$ ($2 \le L \le 100,000$) candidate locations. Since the base stations work in the same frequency band, they will interfere and cause severe performance degradation. To provide high quality communication experience to customers, the company would like to maximize the distance between the base stations so as to reduce the wireless interference among the base stations. Suppose the $L$ candidate locations are in a straight line at locations $P_1, P_2, \dots, P_L$ ($0 \le P_i \le 1,000,000$) and the company wants to install $S$ base stations at the $L$ candidate locations. What is the largest minimum distance among the $S$ base stations?
Input Format
The input data includes multiple test sets.
Each set starts with a line which specifies $L$ (i.e., the number of candidate locations) and $S$ (i.e., the number of base stations). The next line contains $L$ space-separated integers which represent $P_1, P_2, \dots, P_L$. The input data ends with “$0$ $0$”.
Output Format
For each set, you need to output a single line which should be the largest minimum distance among the base stations.
For the first set, the $3$ base stations can be installed at locations $2, 6, 11$.