結果

問題 No.1170 Never Want to Walk
ユーザー kohei2019kohei2019
提出日時 2022-07-19 22:39:42
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,073 bytes
コンパイル時間 393 ms
コンパイル使用メモリ 87,040 KB
実行使用メモリ 113,104 KB
最終ジャッジ日時 2023-09-14 19:41:13
合計ジャッジ時間 11,211 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 93 ms
71,576 KB
testcase_01 AC 94 ms
71,568 KB
testcase_02 AC 94 ms
71,580 KB
testcase_03 AC 98 ms
71,520 KB
testcase_04 AC 94 ms
71,280 KB
testcase_05 AC 95 ms
71,444 KB
testcase_06 AC 93 ms
71,708 KB
testcase_07 AC 94 ms
71,276 KB
testcase_08 AC 91 ms
71,416 KB
testcase_09 AC 91 ms
71,572 KB
testcase_10 AC 91 ms
71,604 KB
testcase_11 AC 92 ms
71,280 KB
testcase_12 AC 118 ms
77,016 KB
testcase_13 AC 125 ms
77,368 KB
testcase_14 AC 126 ms
77,592 KB
testcase_15 AC 122 ms
76,892 KB
testcase_16 AC 120 ms
77,000 KB
testcase_17 AC 131 ms
78,316 KB
testcase_18 AC 118 ms
76,944 KB
testcase_19 AC 119 ms
77,164 KB
testcase_20 AC 128 ms
77,096 KB
testcase_21 AC 121 ms
76,588 KB
testcase_22 AC 141 ms
77,556 KB
testcase_23 AC 140 ms
78,148 KB
testcase_24 AC 138 ms
77,600 KB
testcase_25 AC 138 ms
77,616 KB
testcase_26 AC 140 ms
77,968 KB
testcase_27 AC 470 ms
112,892 KB
testcase_28 AC 484 ms
112,424 KB
testcase_29 AC 514 ms
113,104 KB
testcase_30 AC 480 ms
112,604 KB
testcase_31 AC 474 ms
112,592 KB
testcase_32 TLE -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect
import collections

def main():
    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]])
main()
0