結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
16,640 KB
testcase_01 AC 35 ms
10,880 KB
testcase_02 AC 34 ms
11,008 KB
testcase_03 AC 32 ms
10,880 KB
testcase_04 AC 31 ms
10,880 KB
testcase_05 AC 33 ms
11,008 KB
testcase_06 AC 31 ms
10,880 KB
testcase_07 AC 32 ms
11,008 KB
testcase_08 AC 32 ms
10,880 KB
testcase_09 AC 32 ms
11,008 KB
testcase_10 AC 31 ms
10,880 KB
testcase_11 AC 32 ms
11,008 KB
testcase_12 AC 37 ms
11,264 KB
testcase_13 AC 42 ms
11,520 KB
testcase_14 AC 39 ms
11,392 KB
testcase_15 AC 38 ms
11,392 KB
testcase_16 AC 40 ms
11,264 KB
testcase_17 AC 40 ms
11,392 KB
testcase_18 AC 40 ms
11,392 KB
testcase_19 AC 39 ms
11,264 KB
testcase_20 AC 40 ms
11,392 KB
testcase_21 AC 39 ms
11,264 KB
testcase_22 AC 49 ms
11,776 KB
testcase_23 AC 48 ms
11,648 KB
testcase_24 AC 49 ms
11,520 KB
testcase_25 AC 49 ms
11,648 KB
testcase_26 AC 50 ms
11,648 KB
testcase_27 AC 1,915 ms
110,704 KB
testcase_28 AC 1,971 ms
110,960 KB
testcase_29 AC 1,799 ms
107,096 KB
testcase_30 AC 1,917 ms
112,536 KB
testcase_31 AC 1,937 ms
109,016 KB
testcase_32 TLE -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
権限があれば一括ダウンロードができます

ソースコード

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