結果

問題 No.1110 好きな歌
コンテスト
ユーザー xuanji
提出日時 2020-07-10 21:52:38
言語 PyPy3
(7.3.23 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 233 ms / 5,000 ms
+ 71µs
コード長 414 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 74 ms
コンパイル使用メモリ 80,896 KB
実行使用メモリ 162,576 KB
最終ジャッジ日時 2026-09-13 21:15:02
合計ジャッジ時間 11,412 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge3_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 51
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#!/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