結果
問題 | No.323 yuki国 |
ユーザー |
|
提出日時 | 2021-09-16 02:12:01 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 529 ms / 5,000 ms |
コード長 | 845 bytes |
コンパイル時間 | 170 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 120,448 KB |
最終ジャッジ日時 | 2024-06-29 03:03:17 |
合計ジャッジ時間 | 10,901 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 6 |
other | AC * 32 |
ソースコード
from collections import dequeH,W=map(int,input().split())A,sx,sy=map(int,input().split())B,gx,gy=map(int,input().split())g=['']*Hfor i in range(H):g[i]=input()dist=[-1]*50*50*1500dist[sx*50*1500+sy*1500+A]=0que=deque([sx*50*1500+sy*1500+A])dx=[1,0,-1,0]dy=[0,1,0,-1]while que:now=que.popleft()sz=now%1500now//=1500y=now%50now//=50x=nowfor i in range(4):nx=x+dx[i]ny=y+dy[i]if nx<0 or ny<0 or nx>=H or ny>=W:continuent=szif g[nx][ny]=='*':nt+=1else:nt-=1if nt>=1500 or nt<1:continueto=nx*50*1500+ny*1500+ntif dist[to]!=-1:continuedist[to]=0que.append(to)if dist[gx*50*1500+gy*1500+B]==0:print('Yes')else:print('No')