#P17185. [ICPC 2017 Hong Kong R] Base Station Sites

[ICPC 2017 Hong Kong R] Base Station Sites

Problem Description

5G5G is the proposed next telecommunications standards beyond the current 4G4G standards. 5G5G planning aims at higher capacity than current 4G4G, 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 SS (2SL2 \le S \le L) base stations at LL (2L100,0002 \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 LL candidate locations are in a straight line at locations P1,P2,,PLP_1, P_2, \dots, P_L (0Pi1,000,0000 \le P_i \le 1,000,000) and the company wants to install SS base stations at the LL candidate locations. What is the largest minimum distance among the SS base stations?

Input Format

The input data includes multiple test sets.

Each set starts with a line which specifies LL (i.e., the number of candidate locations) and SS (i.e., the number of base stations). The next line contains LL space-separated integers which represent P1,P2,,PLP_1, P_2, \dots, P_L. The input data ends with “00 00”.

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 33 base stations can be installed at locations 2,6,112, 6, 11.

5 3
2 3 9 6 11
4 3
1 4 9 10
0 0
4
3