#P11569. 「chaynOI R1 T2」画图软件
「chaynOI R1 T2」画图软件
Background
14:27 Added the sample explanation for T2.

Problem Description
You are given a sequence . You can perform at most "pen down" operations. Each time, choose a position and set (that is, add to the -th term of ). Find the number of possible final sequences such that becomes an arithmetic progression with a non-negative common difference.
Input Format
The first line contains two integers .
The second line contains integers, representing the sequence .
Output Format
Output one integer in one line, representing the answer.
5 6
1 2 3 4 5
2
Hint
Sample Explanation
There are and , possibilities in total.
Constraints
For of the testdata, , and .
This problem uses bundled tests.
- Subtask 1 (20 pts): .
- Subtask 2 (15 pts): .
- Subtask 3 (15 pts): .
- Subtask 4 (50 pts): No special constraints.
Translated by ChatGPT 5