問題一覧 > 通常問題

No.1110 Favorite Songs

レベル : / 実行時間制限 : 1ケース 5.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 305
作問者 : trineutron / テスター : platinum
お気に入りにしたユーザー ProblemId : 3488 / 自分の提出
問題文最終更新日: 2022-04-26 02:04:31
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 256 (順位表) の他の問題:

Problem Statement

Orion has $N$ favorite songs, and the affinity of song $i (1 \le i \le N)$ is $A_i$. Since Orion is bad at grasping his own feelings, he cannot recognize that he likes song $i$ more than song $j$ unless $A_i - A_j \ge D$. For each $i$ from $1$ to $N$, find how many $j$ there are such that he recognizes that he likes song $i$ more than song $j$.

Input

$N\ D$
$A_1$
$A_2$
$\dots$
$A_N$

The first line contains the number of songs $N$ and $D$.
Each of the following $N$ lines contains $A_i$.

All inputs are integers.
$1 \le N \le 2 \times 10^5$
$1 \le D \le 10^9$
$1 \le A_i \le 10^9$

Output

Output $N$ lines. On the $i$-th line, output the number of $j$ such that $A_i - A_j \ge D (1 \le j \le N, i \ne j)$. Print a newline at the end.

Sample

Sample 1
Input
5 2
1
2
3
3
4
Output
0
0
1
1
2

Sample 2
Input
1 1
9
Output
0

Sample 3
Input
10 3
3
1
4
1
5
9
2
6
5
3
Output
0
0
2
0
3
9
0
5
3
0

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