Problem 707
Minimize Max Distance to Gas Station
Hard · 30 pts · Array, Binary Search, Heap
Problem
Gas stations stand at the given sorted integer positions on a road. You must build exactly K new stations at any real positions. Minimise the largest distance between two neighbouring stations afterwards. If c new stations go into a gap of length g, the best placement splits it evenly into g / (c + 1). Give each new station to the gap whose current piece is longest (a max-heap compared by g / (c + 1)). Print the answer as an irreducible fraction P/Q.
Input
The first line contains N and K. The second line contains the N station positions in increasing order.
Output
Print the minimum possible maximum distance as P/Q in lowest terms (Q may be 1).
Constraints
2 <= N <= 2000; 1 <= K <= 100000; 0 <= positions <= 10^8; positions are strictly increasing
Example input
5 1 1 2 3 4 5
Example output
1/1
Explanation
Stations at 1 2 3 4 5 have gaps of 1. With K = 1, putting the new station in the middle of one gap leaves pieces of 1/2, but the other gaps are still 1, so the answer is 1/1.