#ABC477B. 离群者 / Standing Outliers
离群者 / Standing Outliers
Problem Statement
There are people on a number line. The people are numbered to , and person is at coordinate . Multiple people may be at the same coordinate.
A person is said to "stand apart" if their distance to every other person is at least .
Formally, person is said to "stand apart" if holds for all .
Output the numbers of all people who "stand apart" in ascending order.
Constraints
- All input values are integers.
Input
The input is given from Standard Input in the following format:
Output
Let be the number of people who stand apart, and let be the sequence of their numbers sorted in ascending order. Output them in the following format:
If , the second line should be empty.
3 3
1 5 7
1
1
- Person has distance to person and distance to person , so their distance to every other person is at least . Thus, person "stands apart".
- Person has distance to person , so person does not "stand apart".
- Similarly, person has distance to person , so person does not "stand apart" either.
- Thus, only person "stands apart".
3 2
1 1 1
0
- There may be people at the same coordinate. Also, if no one "stands apart", the second line should be empty.
8 3
4 77 20 26 9 26 22 40
4
1 2 5 8
-
Output the numbers of the people who "stand apart" in ascending order.
-
Source: AtCoder ABC 477 B
相关
在下列比赛中: