#P6174. [USACO16JAN] Angry Cows S
[USACO16JAN] Angry Cows S
Description
Bessie designed a new game: Angry Cows. In this game, the player launches cows, and each cow explodes on landing, detonating hay bales within a certain range. The goal of the game is to use a set of cows to detonate all the hay bales.
There are hay bales located at distinct positions on a number line. The position of the -th hay bale is . If a cow with power lands at position , she will detonate all hay bales in the range .
You can now launch cows, each with power . You need to determine the minimum value of such that all hay bales can be detonated using cows.
Input Format
The first line contains two integers (, ).
The next lines each contain an integer ().
Output Format
Output one integer, the minimum value of .
7 2
20
25
18
8
10
3
1
5
Hint
Translated by ChatGPT 5
京公网安备 11011102002149号