問題一覧 > 通常問題

No.2803 Bocching Star

レベル : / AI推定難易度 : 296 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (解説公開後に AC するまで非表示) / 解いたユーザー数 168
作問者 : hirayuu_yc / テスター : highlighter Magentor keisuke6 silv723 Yoyoyo8128 zeta7532 fact493
お気に入りにしたユーザー ProblemId : 11052 / 自分の提出
問題文最終更新日: 2024-07-12 20:52:07
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 436 ('09 Contest 002 day1) (順位表) の他の問題:

Story

You do not necessarily have to read this section.

halc: "The Paken training camp sure was fun."

QgQ: "But you couldn't form a team at all."

halc: "Shut up, you loophole team."

Problem Statement

There are $N$ stars in the night sky. The stars are numbered $1,2,\dots,N$.

The night sky can be regarded as a number line, and star $i$ is at coordinate $P_i$. Multiple stars may be at the same coordinate.

A star is called an isolated star if and only if there is no other star within distance $S$ of it.

More strictly, star $i$ being an isolated star is equivalent to $S<|P_i-P_j|$ holding for every $j$ such that $i\ne j$.

List the isolated stars in ascending order of their numbers.

Input

$N\ S$
$P_1\ P_2\dots P_N$
  • $1\leq N\leq 2\times 10^5$
  • $0\leq S\leq 10^9$
  • $0\leq P_i\leq 10^9$
  • There is at least $1$ isolated star.
  • All input values are integers.

Output

Output $2$ lines.

On the $1$st line, output the number of isolated stars.

On the $2$nd line, output the numbers of the isolated stars in ascending order, separated by single-byte spaces.

Print a newline at the end.

Sample

Sample 1
Input
4 2
3 1 6 10
Output
2
3 4

Star $1$ and star $2$ are at distance $2$. Therefore, star $1$ and star $2$ are not isolated stars.

The distances between stars $1,2,3$ and star $4$ are $7,9,4$ respectively, so star $4$ is an isolated star. Similarly, it can be verified that star $3$ is also an isolated star.

For example, outputting 4 3 on the $2$nd line is not allowed, because the numbers are not in ascending order.

Sample 2
Input
1 1000000000
0
Output
1
1

It seems there are no stars in the night sky other than star $1$.

Sample 3
Input
9 0
9 9 8 2 4 4 3 5 3
Output
3
3 4 8

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。