結果

問題 No.1170 Never Want to Walk
ユーザー しーあるしーある
提出日時 2020-08-15 08:38:05
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 996 bytes
コンパイル時間 109 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 272,092 KB
最終ジャッジ日時 2024-04-18 23:44:35
合計ジャッジ時間 11,295 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
16,512 KB
testcase_01 AC 31 ms
11,008 KB
testcase_02 AC 30 ms
11,008 KB
testcase_03 AC 30 ms
11,008 KB
testcase_04 AC 30 ms
11,008 KB
testcase_05 AC 31 ms
11,008 KB
testcase_06 AC 28 ms
11,008 KB
testcase_07 AC 29 ms
11,008 KB
testcase_08 AC 27 ms
11,008 KB
testcase_09 AC 28 ms
11,008 KB
testcase_10 AC 30 ms
11,008 KB
testcase_11 AC 29 ms
11,008 KB
testcase_12 AC 33 ms
11,264 KB
testcase_13 AC 32 ms
11,392 KB
testcase_14 AC 35 ms
11,392 KB
testcase_15 AC 37 ms
11,392 KB
testcase_16 AC 34 ms
11,392 KB
testcase_17 AC 33 ms
11,392 KB
testcase_18 AC 33 ms
11,264 KB
testcase_19 AC 34 ms
11,264 KB
testcase_20 AC 34 ms
11,392 KB
testcase_21 AC 34 ms
11,264 KB
testcase_22 AC 39 ms
11,648 KB
testcase_23 AC 36 ms
11,648 KB
testcase_24 AC 37 ms
11,520 KB
testcase_25 AC 36 ms
11,648 KB
testcase_26 AC 38 ms
11,776 KB
testcase_27 AC 1,168 ms
114,140 KB
testcase_28 AC 1,155 ms
112,972 KB
testcase_29 AC 1,146 ms
109,212 KB
testcase_30 AC 1,185 ms
114,708 KB
testcase_31 AC 1,135 ms
112,188 KB
testcase_32 TLE -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import*
def main():
    n,a,b,*x=map(int,open(0).read().split())
    e=[[]]+[[i+i,i-~i]for i in range(1,n)]+[[]for _ in range(n)]
    for i,y in enumerate(x,n):
        l,r=bisect(x,y-b-1)+n,bisect(x,y-a)+n
        while l<r:
            if l&1:
                e[i]+=l,
                l+=1
            if r&1:
                r-=1
                e[i]+=r,
            l>>=1
            r>>=1
        l,r=bisect(x,y+a-1)+n,bisect(x,y+b)+n
        while l<r:
            if l&1:
                e[i]+=l,
                l+=1
            if r&1:
                r-=1
                e[i]+=r,
            l>>=1
            r>>=1
    a=[0]*n*2
    for s in range(n,n+n):
        if a[s]:continue
        c=a[s]=1
        q=[s]
        p={s}
        for v in q:
            for w in e[v]:
                if a[w]:continue
                if w>=n:c+=1
                a[w]=1
                p|={w}
                q+=w,
        for v in p:a[v]=c
    print('\n'.join(map(str,a[n:])))
main()
0