結果

問題 No.1170 Never Want to Walk
ユーザー kohei2019kohei2019
提出日時 2022-07-19 22:36:49
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 933 bytes
コンパイル時間 287 ms
コンパイル使用メモリ 87,096 KB
実行使用メモリ 113,044 KB
最終ジャッジ日時 2023-09-14 19:36:12
合計ジャッジ時間 12,223 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 91 ms
71,372 KB
testcase_01 AC 93 ms
71,580 KB
testcase_02 AC 93 ms
71,528 KB
testcase_03 AC 94 ms
71,532 KB
testcase_04 AC 94 ms
71,556 KB
testcase_05 AC 95 ms
71,676 KB
testcase_06 AC 92 ms
71,620 KB
testcase_07 AC 93 ms
71,584 KB
testcase_08 AC 92 ms
71,264 KB
testcase_09 AC 92 ms
71,764 KB
testcase_10 AC 92 ms
71,680 KB
testcase_11 AC 92 ms
71,412 KB
testcase_12 AC 119 ms
76,732 KB
testcase_13 AC 126 ms
77,436 KB
testcase_14 AC 120 ms
77,256 KB
testcase_15 AC 116 ms
76,728 KB
testcase_16 AC 116 ms
76,808 KB
testcase_17 AC 129 ms
78,376 KB
testcase_18 AC 114 ms
76,828 KB
testcase_19 AC 120 ms
76,968 KB
testcase_20 AC 125 ms
77,452 KB
testcase_21 AC 115 ms
76,752 KB
testcase_22 AC 130 ms
77,840 KB
testcase_23 AC 132 ms
78,088 KB
testcase_24 AC 132 ms
77,724 KB
testcase_25 AC 128 ms
77,744 KB
testcase_26 AC 134 ms
78,332 KB
testcase_27 AC 497 ms
112,688 KB
testcase_28 AC 473 ms
112,116 KB
testcase_29 AC 497 ms
113,044 KB
testcase_30 AC 471 ms
112,664 KB
testcase_31 AC 478 ms
112,012 KB
testcase_32 TLE -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect
import collections
N,A,B = map(int,input().split())
lsx = list(map(int,input().split()))

used = [-1]*(N)
ap = [False]*(N)
for i in range(N):
    if used[i] != -1:
        continue
    d = collections.deque([i])
    while d:
        now = d.popleft()
        if used[now] != -1:
            continue
        used[now] = i
        indl = bisect.bisect_left(lsx, lsx[now]-B)
        indr = bisect.bisect_right(lsx, lsx[now]-A)
        for nex in range(indl,indr):
            if used[nex] != -1 or ap[nex]:
                continue
            ap[nex] = True
            d.append(nex)
        indl = bisect.bisect_left(lsx, lsx[now]+A)
        indr = bisect.bisect_right(lsx, lsx[now]+B)
        for nex in range(indl,indr):
            if used[nex] != -1 or ap[nex]:
                continue
            ap[nex] = True
            d.append(nex)

cnt = collections.Counter(used)
for i in range(N):
    print(cnt[used[i]])
0