20210919初中组-区间划分
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
Description
对于给定的长度为 的整数序列,求该序列最少可以被划分成多少个区间,使得每个区间都是等差数列。
例如,有一个序列 ,最少可被划分为三个区间 , 和 。
如果给定的序列中有 ,则可以根据需要将其替换成任意正整数。
Input Format
第一行仅有一个正整数 ,第二行包含个数 ( 或 )。
Output Format
仅有一个正整数,表示最少可以被划分的区间数。
9
8 6 4 2 1 4 7 10 2
3
9
-1 6 -1 2 -1 4 7 -1 2
3
5
-1 -1 -1 -1 -1
1
7
-1 -1 4 5 1 2 3
2
Hint
数据范围:
对于 的数据 ,没有 ; 对另外 的数据 ,没有连续的 ; 对于另外的 数据 ,有很多个 ; 对于的数据, 。
GUC_2025_04_20训练
- Status
- Done
- Rule
- XCPC
- Problem
- 5
- Start at
- 2025-4-20 13:30
- End at
- 2025-4-20 16:30
- Duration
- 3 hour(s)
- Host
- Partic.
- 16