#P7273. ix35 的等差数列
ix35 的等差数列
Description
You are given a positive integer sequence with terms, satisfying .
You may perform some modifications. In one modification, you can change any term of the sequence to any positive integer .
Find the minimum number of modifications needed to turn the original sequence into an arithmetic progression whose common difference is a non-negative integer.
Input Format
The first line contains two integers .
The next line contains integers .
Output Format
Output one integer on a single line, the required answer.
6 1000
1 2 999 4 72 6
2
10 2
2 1 2 2 1 1 2 2 2 2
3
1 1
1
0
Hint
Sample Explanation #1
Change to , and change to .
Constraints
This problem uses bundled testdata.
- Subtask 1 ( points): , .
- Subtask 2 ( points): .
- Subtask 3 ( points): .
- Subtask 4 ( points): .
- Subtask 5 ( points): no special constraints.
For of the testdata, .
Original idea: ix35.
Translated by ChatGPT 5
京公网安备 11011102002149号