#P8656. [蓝桥杯 2017 国 B] 对局匹配
[蓝桥杯 2017 国 B] 对局匹配
Problem Description
Xiao Ming likes to find other people to play Go online on a Go website. All registered users on this website have a rating score, which represents their Go skill level.
Xiao Ming found that when matching opponents, the website’s automatic matchmaking system only matches two users whose rating difference is exactly . If their difference is less than or greater than , the system will not match them.
Now Xiao Ming knows that the website has a total of users, and their ratings are .
Xiao Ming wants to know: at most how many users can be online at the same time looking for opponents, but the system still cannot match even a single game (i.e., for any two users, their rating difference is not equal to )?
Input Format
The first line contains two integers and .
The second line contains integers .
Output Format
Output one integer, representing the answer.
10 0
1 4 2 8 5 7 1 4 2 8
6
10 1
2 1 1 1 1 4 4 3 4 4
8
Hint
For of the testdata, .
For of the testdata, , .
Time limit: 1 second, 256 MB. Lanqiao Cup, 2017 8th National Finals.
Translated by ChatGPT 5