結果
問題 |
No.1170 Never Want to Walk
|
ユーザー |
![]() |
提出日時 | 2020-08-14 21:51:41 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 767 bytes |
コンパイル時間 | 420 ms |
コンパイル使用メモリ | 82,432 KB |
実行使用メモリ | 138,172 KB |
最終ジャッジ日時 | 2024-10-10 15:02:51 |
合計ジャッジ時間 | 8,623 ms |
ジャッジサーバーID (参考情報) |
judge1 / 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())) import bisect USEALL=set() ANS=[-1]*N for i in range(N): if i in USEALL: continue Q=[i] USE={i} while Q: x=Q.pop() s=bisect.bisect_left(X,X[x]+a) t=bisect.bisect_right(X,X[x]+b) for j in range(s,t): if j in USE: continue USE.add(j) Q.append(j) s=bisect.bisect_left(X,X[x]-b) t=bisect.bisect_right(X,X[x]-a) for j in range(s,t): if j in USE: continue USE.add(j) Q.append(j) L=len(USE) for t in USE: ANS[t]=L USEALL|=USE for a in ANS: print(a)