結果

問題 No.1170 Never Want to Walk
ユーザー daikisuyamadaikisuyama
提出日時 2020-08-14 22:00:57
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,283 bytes
コンパイル時間 289 ms
コンパイル使用メモリ 82,472 KB
実行使用メモリ 109,800 KB
最終ジャッジ日時 2024-04-18 21:48:25
合計ジャッジ時間 8,725 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
59,776 KB
testcase_01 AC 41 ms
54,016 KB
testcase_02 AC 46 ms
54,016 KB
testcase_03 AC 40 ms
54,144 KB
testcase_04 AC 42 ms
54,272 KB
testcase_05 AC 42 ms
53,632 KB
testcase_06 AC 43 ms
54,016 KB
testcase_07 AC 42 ms
54,272 KB
testcase_08 AC 41 ms
53,760 KB
testcase_09 AC 42 ms
54,016 KB
testcase_10 AC 42 ms
53,504 KB
testcase_11 AC 42 ms
54,016 KB
testcase_12 AC 69 ms
71,552 KB
testcase_13 AC 72 ms
74,368 KB
testcase_14 AC 77 ms
74,368 KB
testcase_15 AC 66 ms
71,040 KB
testcase_16 AC 68 ms
70,784 KB
testcase_17 AC 85 ms
76,800 KB
testcase_18 AC 67 ms
71,680 KB
testcase_19 AC 67 ms
70,272 KB
testcase_20 AC 82 ms
76,544 KB
testcase_21 AC 66 ms
70,272 KB
testcase_22 AC 76 ms
74,368 KB
testcase_23 AC 82 ms
76,544 KB
testcase_24 AC 84 ms
76,288 KB
testcase_25 AC 73 ms
74,496 KB
testcase_26 AC 85 ms
76,672 KB
testcase_27 AC 501 ms
102,664 KB
testcase_28 AC 451 ms
108,672 KB
testcase_29 AC 497 ms
102,956 KB
testcase_30 AC 485 ms
102,360 KB
testcase_31 AC 467 ms
108,888 KB
testcase_32 TLE -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

n,a,b=map(int,input().split())
x=list(map(int,input().split()))
check=[False]*n
from collections import deque
from bisect import bisect_left,bisect_right
ans=[]
for i in range(n):
    if check[i]==False:
        check[i]=True
        ans_sub=[i]
        now=deque({i})
        while len(now):
            for _ in range(len(now)):
                d=x[now.popleft()]
                l1=bisect_left(x,d-b)
                l2=bisect_right(x,d-a)-1
                #print(1)
                #print(l1,l2)
                if l1<=l2:
                    for j in range(l1,l2+1):
                        if check[j]==False:
                            check[j]=True
                            now.append(j)
                            ans_sub.append(j)
                r1=bisect_left(x,d+a)
                r2=bisect_right(x,d+b)-1
                #print(2)
                #print(r1,r2)
                if r1<=r2:
                    for j in range(r1,r2+1):
                        if check[j]==False:
                            check[j]=True
                            now.append(j)
                            ans_sub.append(j)
        ans.append(ans_sub)
#print(check)
#print(ans)
g=[0]*n
for i in ans:
    l=len(i)
    for j in i:
        g[j]=l
for i in range(n):
    print(g[i])
0