PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#BS0000330. Bò nổi giận – Silver (Angry Cows (Silver))

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Bò nổi giận – Silver (Angry Cows (Silver))

Angry Cows (Silver)

Source: USACO

Version: Phuoc Hung OJ Extended

Problem Statement

In Bessie's game, nn hay bales lie at distinct integer coordinates xix_i on a line. The player has kk cows to launch, all with the same nonnegative integer power RR.

A cow landing at coordinate pp destroys every bale in the closed interval [p−R,p+R][p-R,p+R]. The landing point may be chosen freely; destroyed bales do not cause further blasts.

Find the smallest integer power RR that allows all bales to be destroyed using at most kk launches.

Input

The first line contains two integers n,kn,k, the numbers of bales and available cows.

Each of the next nn lines contains one integer xix_i, the coordinate of bale ii.

Output

Print one nonnegative integer: the minimum power RR.

Subtasks

  • Subtask 1 (20 points): 1≤n≤121\le n\le12; 1≤k≤101\le k\le10; 0≤xi≤300\le x_i\le30; xi≠xjx_i\ne x_j for i≠ji\ne j.
  • Subtask 2 (30 points): 1≤n≤500001\le n\le50000; k=1k=1; 0≤xi≤1090\le x_i\le10^9; xi≠xjx_i\ne x_j for i≠ji\ne j.
  • Subtask 3 (50 points): 1≤n≤500001\le n\le50000; 1≤k≤101\le k\le10; 0≤xi≤1090\le x_i\le10^9; xi≠xjx_i\ne x_j for i≠ji\ne j.

Examples

Input 1

7 2
20
25
18
8
10
3
1

Output 1

5

Explanation

Launch at 5 and 20 with R=5R=5, covering [0,10] and [15,25]. For R=4R=4, each blast spans 8 units. The three bales at 1, 10 and 25 require separate blasts, so two launches are insufficient.

Input 2

2 2
1
9

Output 2

0

Explanation

Launch at 1 and 9. With R=0R=0, each launch destroys the bale at its landing point. Since power cannot be negative, zero is optimal.