#abc255e. E - Lucky Numbers(waiting SPJ)
E - Lucky Numbers(waiting SPJ)
Score : points
问题描述
给定一个包含 个整数的序列 ,以及 个不同的整数 ,它们被称为 幸运数。
满足以下条件的一组包含 个整数的序列 被称为 好序列。
对于所有 ,有 成立。
找出好序列 中最多可能有多少项是幸运数,即在 到 之间整数 的最大数量,使得 。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
You are given a sequence of integers , and distinct integers , which are called lucky numbers.
A sequence of integers satisfying the following condition is called a good sequence.
holds for every .
Find the maximum possible number of terms that are lucky numbers in a good sequence , that is, the maximum possible number of integers between and such that .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the maximum possible number of terms that are lucky numbers in a good sequence .
Sample Input 1
9 2
2 3 3 4 -4 -7 -4 -1
-1 5
Sample Output 1
4
A good sequence contains four terms that are lucky numbers: , which is the maximum possible count.
Sample Input 2
20 10
-183260318 206417795 409343217 238245886 138964265 -415224774 -499400499 -313180261 283784093 498751662 668946791 965735441 382033304 177367159 31017484 27914238 757966050 878978971 73210901
-470019195 -379631053 -287722161 -231146414 -84796739 328710269 355719851 416979387 431167199 498905398
Sample Output 2
8
update @ 2024/3/10 10:51:57