#abc326c. C - Peak
C - Peak
Score : points
问题描述
Takahashi 在数轴上放置了 个礼物。第 个礼物位于坐标点 。
你需要在数轴上选择一个长度为 的半开区间 并获取其中包含的所有礼物。 具体来说,你将按照以下步骤获取礼物:
- 首先,选择一个实数 。
- 然后,获取所有满足坐标条件 的礼物。
你能获取到的最大礼物数量是多少?
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
Takahashi has placed gifts on a number line. The -th gift is placed at coordinate .
You will choose a half-open interval of length on the number line and acquire all the gifts included in it. More specifically, you acquire gifts according to the following procedure.
- First, choose one real number .
- Then, acquire all the gifts whose coordinates satisfy .
What is the maximum number of gifts you can acquire?
Constraints
- All input values are integers.
Input
The input is given from Standard Input in the following format:
Output
Print the answer as an integer.
Sample Input 1
8 6
2 3 5 7 11 13 17 19
Sample Output 1
4
For example, specify the half-open interval . In this case, you can acquire the four gifts at coordinates , the maximum number of gifts that can be acquired.
Sample Input 2
10 1
3 1 4 1 5 9 2 6 5 3
Sample Output 2
2
There may be multiple gifts at the same coordinate.
Sample Input 3
10 998244353
100000007 0 1755647 998244353 495 1000000000 1755648 503 1755649 998244853
Sample Output 3
7
update @ 2024/3/10 01:49:13