logo AlgoBeat OnlineJudge
登录 注册

#215453. [VKOSHP 2025] Predicting a Position

内存限制:512 MiB 时间限制:1000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

An ascending sorted array of unique integer keys and some integer non-negative constant is given.

It is necessary to split the original key array into a minimum number of sub-arrays, so that on each sub-array there is some linear function , predicting for the key its position on this sub-array --- it is equal to --- with an error not exceeding .

Formally, for the -th of the sub-array, the coefficients and must exist (not necessarily integers) so that for all the keys on that sub-array is true:

输入格式

In the first line of the input data, two integers are separated by a space: , --- the number of keys and the maximum allowable error, respectively (, ).

The second line of input data contains the unique keys separated by a space in ascending order ().

输出格式

In a single line of the output data, print a single integer --- the minimum number of sub-arrays into which you were able to split the original array of keys so as to meet the requirements.

样例

样例输入 1

8 0
1 2 3 4 7 10 13 16

样例输出 1

2

数据范围与提示

In the example, you can split the specified array of keys into two: and . In the first case, the key position is predicted exactly by the function . In the second case, the key position is accurately predicted by the function .