突出的离群者AI (CI翻译)
Problem Statement
题目描述
AI (CI翻译)There are $N$ people on a number line. The people are numbered $1$ to $N$, and person $i$ is at coordinate $X_i$. Multiple people may be at the same coordinate.
数轴上有 $N$ 个人。人们的编号为 $1$ 到 $N$,第 $i$ 个人位于坐标 $X_i$。多个 人可能位于同一坐标。AI (CI翻译)
A person is said to "stand apart" if their distance to every other person is at least $D$.
如果一个人与其他每个人的距离都至少为 $D$,则称这个人“独立突出”。AI (CI翻译)
Formally, person $i$ is said to "stand apart" if $|X_i-X_j| \geq D$ holds for all $j ~ (1 \leq j \leq N,\ j \neq i)$.
形式化地说,对于所有满足 $j ~ (1 \leq j \leq N,\ j \neq i)$ 的 $j$,若均有 $|X_i-X_j| \geq D$,则称第 $i$ 个人“独立突出”。AI (CI翻译)
Output the numbers of all people who "stand apart" in ascending order.
请按升序输出所有“独立突出”的人的编号。AI (CI翻译)
Constraints
约束条件
AI (CI翻译)$2 \le N \le 100$$1 \le D \le 10^9$$1 \le X_i \le 10^9$- All input values are integers.
$2 \leq N \leq 100$$1 \leq D \leq 10^9$$1 \leq X_i \leq 10^9$- 所有输入值均为整数。
Input
输入格式
AI (CI翻译)The input is given from Standard Input in the following format:
输入从标准输入按以下格式给出:AI (CI翻译)
N D
X_1 X_2 \dots X_N
N D
X_1 X_2 \dots X_NAI (CI翻译)
Output
输出格式
AI (CI翻译)Let $K$ be the number of people who stand apart, and let $(P_1,P_2,\dots,P_K)$ be the sequence of their numbers sorted in ascending order. Output them in the following format:
设独立突出的人数为 $K$,将这些人的编号按升序排列后得到序列 $(P_1,P_2,\dots,P_K)$。请按以下格式输出:AI (CI翻译)
K
P_1 P_2 \dots P_K
K
P_1 P_2 \dots P_KAI (CI翻译)
If $K=0$, the second line should be empty.
当 $K=0$ 时,第二行应为空。AI (CI翻译)
样例
3 3
1 5 7
1
1
3 2
1 1 1
0
8 3
4 77 20 26 9 26 22 40
4
1 2 5 8
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(gpt-6.1-sol),如有出入请以原文为准。