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