結果

問題 No.1110 好きな歌
ユーザー anagohirame
提出日時 2020-07-10 22:08:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 903 ms / 5,000 ms
コード長 303 bytes
コンパイル時間 394 ms
コンパイル使用メモリ 82,008 KB
実行使用メモリ 123,068 KB
最終ジャッジ日時 2024-10-11 09:24:45
合計ジャッジ時間 23,176 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 51
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import bisect
from collections import Counter
n, d = map(int, input().split())
a = [int(input()) for _ in range(n)]
c = sorted(list(Counter(a).items()))
keys, values = [-10**20], [0]
for i, j in c:
	keys.append(i)
	values.append(values[-1]+j)

for x in a:
	print(values[bisect(keys, x-d)-1])
0