結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
62,756 KB
testcase_01 AC 43 ms
54,532 KB
testcase_02 AC 41 ms
54,048 KB
testcase_03 AC 40 ms
54,656 KB
testcase_04 AC 41 ms
54,584 KB
testcase_05 AC 41 ms
55,444 KB
testcase_06 AC 41 ms
55,332 KB
testcase_07 AC 41 ms
55,032 KB
testcase_08 AC 39 ms
54,608 KB
testcase_09 AC 41 ms
55,188 KB
testcase_10 AC 40 ms
54,956 KB
testcase_11 AC 41 ms
54,976 KB
testcase_12 AC 67 ms
73,028 KB
testcase_13 AC 72 ms
74,280 KB
testcase_14 AC 72 ms
74,516 KB
testcase_15 AC 66 ms
72,424 KB
testcase_16 AC 67 ms
71,460 KB
testcase_17 AC 87 ms
76,728 KB
testcase_18 AC 65 ms
72,432 KB
testcase_19 AC 65 ms
71,452 KB
testcase_20 AC 76 ms
76,620 KB
testcase_21 AC 66 ms
73,228 KB
testcase_22 AC 72 ms
74,424 KB
testcase_23 AC 83 ms
76,516 KB
testcase_24 AC 83 ms
76,464 KB
testcase_25 AC 73 ms
74,624 KB
testcase_26 AC 82 ms
76,604 KB
testcase_27 AC 492 ms
102,652 KB
testcase_28 AC 461 ms
106,992 KB
testcase_29 AC 497 ms
102,828 KB
testcase_30 AC 483 ms
102,392 KB
testcase_31 AC 459 ms
106,968 KB
testcase_32 TLE -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=sys.stdin.readline
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=deque({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
                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
                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)
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