結果

問題 No.1170 Never Want to Walk
ユーザー しーあるしーある
提出日時 2020-08-15 07:56:10
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 893 ms / 2,000 ms
コード長 818 bytes
コンパイル時間 332 ms
コンパイル使用メモリ 87,176 KB
実行使用メモリ 226,568 KB
最終ジャッジ日時 2023-08-01 00:48:12
合計ジャッジ時間 14,222 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,300 KB
testcase_01 AC 70 ms
71,464 KB
testcase_02 AC 69 ms
71,424 KB
testcase_03 AC 72 ms
71,460 KB
testcase_04 AC 70 ms
71,332 KB
testcase_05 AC 69 ms
71,404 KB
testcase_06 AC 71 ms
71,500 KB
testcase_07 AC 70 ms
71,204 KB
testcase_08 AC 71 ms
71,464 KB
testcase_09 AC 68 ms
71,348 KB
testcase_10 AC 68 ms
71,400 KB
testcase_11 AC 69 ms
71,204 KB
testcase_12 AC 88 ms
76,752 KB
testcase_13 AC 95 ms
76,808 KB
testcase_14 AC 100 ms
77,448 KB
testcase_15 AC 87 ms
76,456 KB
testcase_16 AC 88 ms
76,276 KB
testcase_17 AC 100 ms
77,444 KB
testcase_18 AC 86 ms
76,516 KB
testcase_19 AC 90 ms
76,564 KB
testcase_20 AC 104 ms
77,620 KB
testcase_21 AC 86 ms
76,492 KB
testcase_22 AC 124 ms
77,896 KB
testcase_23 AC 125 ms
77,932 KB
testcase_24 AC 119 ms
77,948 KB
testcase_25 AC 125 ms
77,816 KB
testcase_26 AC 127 ms
77,756 KB
testcase_27 AC 612 ms
140,852 KB
testcase_28 AC 603 ms
131,608 KB
testcase_29 AC 589 ms
127,184 KB
testcase_30 AC 611 ms
130,648 KB
testcase_31 AC 603 ms
134,224 KB
testcase_32 AC 846 ms
220,500 KB
testcase_33 AC 882 ms
215,756 KB
testcase_34 AC 830 ms
218,944 KB
testcase_35 AC 893 ms
226,568 KB
testcase_36 AC 750 ms
213,440 KB
testcase_37 AC 787 ms
216,816 KB
testcase_38 AC 793 ms
217,484 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import*
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
for s in range(n,n+n):
    if a[s-n]:continue
    c=1
    f={s}
    q=[s]
    for v in q:
        for w in e[v]:
            if w in f:continue
            if w>=n:c+=1
            f|={w}
            q+=w,
    for v in f:
        if v>=n:a[v-n]=c
print('\n'.join(map(str,a)))
0