結果

問題 No.1110 好きな歌
ユーザー xuanji
提出日時 2020-07-10 21:52:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 342 ms / 5,000 ms
コード長 414 bytes
コンパイル時間 201 ms
コンパイル使用メモリ 81,792 KB
実行使用メモリ 154,240 KB
最終ジャッジ日時 2024-10-11 08:56:37
合計ジャッジ時間 11,210 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 51
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3

from sys import stdin, stdout
 
def input():
    return stdin.readline().strip()

from collections import defaultdict

N, D = input().split(' ')
N = int(N)
D = int(D)

A = []
for _ in range(N):
    A += [int(input())]

ans = dict()

sorted_A = sorted(A)
set_A = sorted(list(set(A)))

i = 0
for a in set_A:
    while a - sorted_A[i] >= D: i += 1
    ans[a] = i

for a in A:
    print(ans[a])
0