結果

問題 No.1170 Never Want to Walk
ユーザー Kiri8128Kiri8128
提出日時 2020-08-14 22:55:57
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 769 bytes
コンパイル時間 357 ms
コンパイル使用メモリ 82,340 KB
実行使用メモリ 105,092 KB
最終ジャッジ日時 2024-04-18 22:44:30
合計ジャッジ時間 9,100 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
58,112 KB
testcase_01 AC 43 ms
52,224 KB
testcase_02 AC 39 ms
52,608 KB
testcase_03 AC 38 ms
52,608 KB
testcase_04 AC 39 ms
52,608 KB
testcase_05 AC 38 ms
52,352 KB
testcase_06 AC 35 ms
52,352 KB
testcase_07 AC 34 ms
52,224 KB
testcase_08 AC 34 ms
52,480 KB
testcase_09 AC 35 ms
52,736 KB
testcase_10 AC 39 ms
52,224 KB
testcase_11 AC 36 ms
52,608 KB
testcase_12 AC 56 ms
66,944 KB
testcase_13 AC 74 ms
76,040 KB
testcase_14 AC 75 ms
75,904 KB
testcase_15 AC 57 ms
67,584 KB
testcase_16 AC 55 ms
69,304 KB
testcase_17 AC 75 ms
76,152 KB
testcase_18 AC 54 ms
66,688 KB
testcase_19 AC 55 ms
70,968 KB
testcase_20 AC 74 ms
76,328 KB
testcase_21 AC 53 ms
67,840 KB
testcase_22 AC 161 ms
75,952 KB
testcase_23 AC 94 ms
76,160 KB
testcase_24 AC 139 ms
75,968 KB
testcase_25 AC 162 ms
76,160 KB
testcase_26 AC 121 ms
75,920 KB
testcase_27 AC 396 ms
98,328 KB
testcase_28 AC 452 ms
98,176 KB
testcase_29 AC 435 ms
98,620 KB
testcase_30 AC 465 ms
98,776 KB
testcase_31 AC 435 ms
98,400 KB
testcase_32 TLE -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import bisect_right as br
def par(a):
    L = []
    while P[a] >= 0:
        L.append(a)
        a = P[a]
    for l in L:
        P[l] = a
    return a
def unite(a, b):
    if par(a) != par(b):
        if P[par(b)] >= P[par(a)]:
            if P[par(b)] == P[par(a)]: P[par(a)] -= 1
            P[par(b)] = par(a)
        else:
            P[par(a)] = par(b)

N, A, B = map(int, input().split())
P = [-1 for i in range(N)]
X = [int(a) for a in input().split()]
done = [0] * N
i = 0
for i in range(N):
    if done[i]: continue
    done[i] = 1
    j = br(X, X[i] + B) - 1
    while done[j] == 0 and X[j] >= X[i] + A:
        unite(i, j)
        j -= 1

cnt = [0] * N
for i in range(N):
    cnt[par(i)] += 1
print(*[cnt[par(i)] for i in range(N)], sep = "\n")
0