結果
| 問題 | 
                            No.1170 Never Want to Walk
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2020-08-14 22:00:57 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,283 bytes | 
| コンパイル時間 | 287 ms | 
| コンパイル使用メモリ | 82,284 KB | 
| 実行使用メモリ | 109,684 KB | 
| 最終ジャッジ日時 | 2024-10-10 15:15:37 | 
| 合計ジャッジ時間 | 8,983 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 30 TLE * 1 -- * 6 | 
ソースコード
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])