#BS0000330. Bò nổi giận – Silver (Angry Cows (Silver))
Bài tập thuộc lộ trình
Mục lục đề ⌄
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, hay bales lie at distinct integer coordinates on a line. The player has cows to launch, all with the same nonnegative integer power .
A cow landing at coordinate destroys every bale in the closed interval . The landing point may be chosen freely; destroyed bales do not cause further blasts.
Find the smallest integer power that allows all bales to be destroyed using at most launches.
Input
The first line contains two integers , the numbers of bales and available cows.
Each of the next lines contains one integer , the coordinate of bale .
Output
Print one nonnegative integer: the minimum power .
Subtasks
- Subtask 1 (20 points): ; ; ; for .
- Subtask 2 (30 points): ; ; ; for .
- Subtask 3 (50 points): ; ; ; for .
Examples
Input 1
7 2
20
25
18
8
10
3
1
Output 1
5
Explanation
Launch at 5 and 20 with , covering [0,10] and [15,25]. For , 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 , each launch destroys the bale at its landing point. Since power cannot be negative, zero is optimal.