#P6174. Angry Cows

    ID: 19394 Type: Default 1000ms 256MiB

Angry Cows

Angry Cows

Bessie designed a new game: Angry Cows. In this game, players launch cows and each cow detonates hay bales within a certain range upon landing. The objective is to detonate all hay bales using a set of cows.

There are \( N \) hay bales placed at distinct positions along the number line. The position of the \( i \)-th hay bale is \( x_i \). When a cow with power \( R \) lands at position \( x \), it detonates every hay bale in the interval \( [x-R, x+R] \).

You are allowed to launch \( K \) cows, all with the same power \( R \). Determine the minimum \( R \) such that all hay bales are detonated by using at most \( K \) cows.

inputFormat

The first line contains two space-separated integers \( N \) and \( K \) representing the number of hay bales and the number of cows, respectively.

The second line contains \( N \) space-separated integers \( x_1, x_2, \dots, x_N \) representing the positions of the hay bales.

outputFormat

Output a single integer: the minimum \( R \) required to detonate all hay bales using at most \( K \) cows.

sample

5 2
1 2 8 4 9
3

</p>