#P6490. [COCI 2010/2011 #6] RAZINE
[COCI 2010/2011 #6] RAZINE
Description
Given a sequence of length , you may subtract a number from some elements so that the whole sequence becomes strictly increasing.
You need to find the minimum possible value of the sum of all numbers subtracted.
For example, for a sequence of length : . The best plan is , i.e. . Then the sum of all subtracted numbers is , which is the minimum.
Input Format
The first line contains an integer , representing the length of the sequence.
The second line contains integers describing the sequence.
Output Format
Output one integer in one line, representing the minimum total sum.
3
5
5
5
3
4
5
3
7
5
6
Hint
Constraints and Notes
For of the testdata, it is guaranteed that , and all numbers in the sequence are positive integers not greater than .
Notes
Translated from COCI2010-2011 CONTEST #6 T3 RAZINE。
Translated by ChatGPT 5
京公网安备 11011102002149号