Codeforces Round 210 (Div. 1)
B
Levko and Array
Codeforces
2000
原题
← AC →
翻译中…

Levko has an array that consists of integers: $*a*_{1}, *a*_{2}, ... , *a*_{*n*}$. But he doesn’t like this array at all.

翻译中…

Levko thinks that the beauty of the array $*a*$ directly depends on value $*c*(*a*)$, which can be calculated by the formula:

翻译中…

image

翻译中…

The less value

翻译中…

c(a)

翻译中…

is, the more beautiful the array is.

翻译中…

It’s time to change the world and Levko is going to change his array for the better. To be exact, Levko wants to change the values of at most $*k*$ array elements (it is allowed to replace the values by any integers). Of course, the changes should make the array as beautiful as possible.

翻译中…

Help Levko and calculate what minimum number $*c*(*a*)$ he can reach.

翻译中…

Input

翻译中…

The first line contains two integers $*n*$ and $*k*$ ($1 ≤ *k* ≤ *n* ≤ 2000$). The second line contains space-separated integers $*a*_{1}, *a*_{2}, ... , *a*_{*n*}$ ($- 10^{9} ≤ *a*_{*i*} ≤ 10^{9}$).

翻译中…

Output

翻译中…

A single number — the minimum value of $*c*(*a*)$ Levko can get.

翻译中…

Note

翻译中…

In the first sample Levko can change the second and fourth elements and get array: $4$, $4$, $4$, $4$, $4$.

翻译中…

In the third sample he can get array: $1$, $2$, $3$, $4$, $5$, $6$.

翻译中…

样例

Input #1
5 2
4 7 4 7 4
Output #1
0
InputCopy OutputCopy
Input #2
3 1
-100 0 100
Output #2
100
InputCopy OutputCopy
Input #3
6 3
1 2 3 7 8 9
Output #3
1
InputCopy OutputCopy
题目信息
题号
360B
时间限制
2 s
内存限制
256 MB
标签
二分
动态规划

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。