結果

問題 No.1170 Never Want to Walk
ユーザー しーあるしーある
提出日時 2020-08-15 07:56:10
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 911 ms / 2,000 ms
コード長 818 bytes
コンパイル時間 579 ms
コンパイル使用メモリ 82,420 KB
実行使用メモリ 225,360 KB
最終ジャッジ日時 2024-04-18 23:41:36
合計ジャッジ時間 13,150 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
52,464 KB
testcase_01 AC 38 ms
52,736 KB
testcase_02 AC 37 ms
52,608 KB
testcase_03 AC 38 ms
52,736 KB
testcase_04 AC 37 ms
52,736 KB
testcase_05 AC 36 ms
52,608 KB
testcase_06 AC 37 ms
52,224 KB
testcase_07 AC 37 ms
52,480 KB
testcase_08 AC 38 ms
52,992 KB
testcase_09 AC 38 ms
52,224 KB
testcase_10 AC 37 ms
52,992 KB
testcase_11 AC 38 ms
52,864 KB
testcase_12 AC 55 ms
67,968 KB
testcase_13 AC 66 ms
72,448 KB
testcase_14 AC 66 ms
72,832 KB
testcase_15 AC 54 ms
67,200 KB
testcase_16 AC 57 ms
67,968 KB
testcase_17 AC 67 ms
73,088 KB
testcase_18 AC 56 ms
67,456 KB
testcase_19 AC 59 ms
69,120 KB
testcase_20 AC 74 ms
76,800 KB
testcase_21 AC 57 ms
68,608 KB
testcase_22 AC 94 ms
76,884 KB
testcase_23 AC 97 ms
77,036 KB
testcase_24 AC 93 ms
76,804 KB
testcase_25 AC 94 ms
76,644 KB
testcase_26 AC 98 ms
76,704 KB
testcase_27 AC 608 ms
139,760 KB
testcase_28 AC 602 ms
132,820 KB
testcase_29 AC 583 ms
126,684 KB
testcase_30 AC 599 ms
128,280 KB
testcase_31 AC 606 ms
132,284 KB
testcase_32 AC 853 ms
218,824 KB
testcase_33 AC 911 ms
212,760 KB
testcase_34 AC 822 ms
221,076 KB
testcase_35 AC 882 ms
225,360 KB
testcase_36 AC 763 ms
216,528 KB
testcase_37 AC 795 ms
212,036 KB
testcase_38 AC 807 ms
216,292 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