結果

問題 No.1110 好きな歌
ユーザー Coki628Coki628
提出日時 2020-11-24 00:25:10
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 696 ms / 5,000 ms
コード長 943 bytes
コンパイル時間 1,258 ms
コンパイル使用メモリ 87,576 KB
実行使用メモリ 99,392 KB
最終ジャッジ日時 2023-10-01 00:38:54
合計ジャッジ時間 25,645 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 92 ms
72,124 KB
testcase_01 AC 89 ms
71,904 KB
testcase_02 AC 90 ms
72,308 KB
testcase_03 AC 93 ms
71,676 KB
testcase_04 AC 91 ms
72,080 KB
testcase_05 AC 90 ms
71,744 KB
testcase_06 AC 90 ms
72,028 KB
testcase_07 AC 93 ms
72,152 KB
testcase_08 AC 90 ms
72,148 KB
testcase_09 AC 90 ms
72,172 KB
testcase_10 AC 92 ms
71,900 KB
testcase_11 AC 92 ms
71,992 KB
testcase_12 AC 93 ms
72,112 KB
testcase_13 AC 91 ms
71,996 KB
testcase_14 AC 96 ms
72,536 KB
testcase_15 AC 95 ms
72,752 KB
testcase_16 AC 98 ms
72,380 KB
testcase_17 AC 100 ms
72,724 KB
testcase_18 AC 94 ms
72,124 KB
testcase_19 AC 101 ms
76,564 KB
testcase_20 AC 100 ms
72,708 KB
testcase_21 AC 95 ms
72,540 KB
testcase_22 AC 99 ms
72,564 KB
testcase_23 AC 94 ms
72,860 KB
testcase_24 AC 447 ms
91,072 KB
testcase_25 AC 519 ms
93,092 KB
testcase_26 AC 300 ms
85,968 KB
testcase_27 AC 508 ms
92,944 KB
testcase_28 AC 327 ms
87,256 KB
testcase_29 AC 577 ms
95,248 KB
testcase_30 AC 322 ms
87,044 KB
testcase_31 AC 241 ms
82,420 KB
testcase_32 AC 639 ms
96,772 KB
testcase_33 AC 367 ms
87,796 KB
testcase_34 AC 478 ms
91,888 KB
testcase_35 AC 682 ms
99,072 KB
testcase_36 AC 163 ms
79,560 KB
testcase_37 AC 253 ms
83,544 KB
testcase_38 AC 566 ms
94,832 KB
testcase_39 AC 450 ms
90,932 KB
testcase_40 AC 551 ms
95,256 KB
testcase_41 AC 147 ms
79,024 KB
testcase_42 AC 647 ms
96,792 KB
testcase_43 AC 579 ms
95,480 KB
testcase_44 AC 696 ms
99,356 KB
testcase_45 AC 691 ms
99,360 KB
testcase_46 AC 683 ms
99,076 KB
testcase_47 AC 677 ms
99,072 KB
testcase_48 AC 682 ms
99,304 KB
testcase_49 AC 673 ms
99,300 KB
testcase_50 AC 693 ms
99,392 KB
testcase_51 AC 681 ms
99,104 KB
testcase_52 AC 676 ms
99,328 KB
testcase_53 AC 695 ms
99,056 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from collections import deque

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for k in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for k in range(c)] for k in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10**9)
INF = 10**19
MOD = 10**9 + 7
EPS = 10**-10

N, D = MAP()
A = [(a, i) for i, a in enumerate(LIST(N))]

tmp = deque()
cur = 0
ans = [0] * N
A.sort()
for a, i in A:
    while tmp and tmp[0] <= a-D:
        tmp.popleft()
        cur += 1
    tmp.append(a)
    ans[i] = cur

for a in ans:
    print(a)
0