Codeforces Round 371 (Div. 2)
E
Sonya and Problem Wihtout a Legend
Codeforces
未评级
原题
← D→
翻译中…

Sonya was unable to think of a story for this problem, so here comes the formal description.

翻译中…

You are given the array containing $*n*$ positive integers. At one turn you can pick any element and increase or decrease it by $1$. The goal is the make the array strictly increasing by making the minimum possible number of operations. You are allowed to change elements in any way, they can become negative or equal to $0$.

翻译中…

Input

翻译中…

The first line of the input contains a single integer $*n*$ ($1 ≤ *n* ≤ 3000$) — the length of the array.

翻译中…

Next line contains $*n*$ integer $*a*_{*i*}$ ($1 ≤ *a*_{*i*} ≤ 10^{9}$).

翻译中…

Output

翻译中…

Print the minimum number of operation required to make the array strictly increasing.

翻译中…

Note

翻译中…

In the first sample, the array is going to look as follows:

翻译中…

$2$ $3$ $5$ $6$ $7$ $9$ $11$

翻译中…

$|2 - 2| + |1 - 3| + |5 - 5| + |11 - 6| + |5 - 7| + |9 - 9| + |11 - 11| = 9$

翻译中…

And for the second sample:

翻译中…

$1$ $2$ $3$ $4$ $5$

翻译中…

$|5 - 1| + |4 - 2| + |3 - 3| + |2 - 4| + |1 - 5| = 12$

翻译中…

样例

Input #1
7
2 1 5 11 5 9 11
Output #1
9
InputCopy OutputCopy
Input #2
5
5 4 3 2 1
Output #2
12
InputCopy OutputCopy
题目信息
题号
714E
时间限制
5 s
内存限制
256 MB

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