結果
| 問題 | No.323 yuki国 |
| コンテスト | |
| ユーザー |
titia
|
| 提出日時 | 2023-07-26 11:31:39 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 1,715 ms / 5,000 ms |
| コード長 | 794 bytes |
| コンパイル時間 | 180 ms |
| コンパイル使用メモリ | 82,432 KB |
| 実行使用メモリ | 305,424 KB |
| 最終ジャッジ日時 | 2024-10-02 22:42:36 |
| 合計ジャッジ時間 | 15,769 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 6 |
| other | AC * 32 |
ソースコード
import sys
input = sys.stdin.readline
H,W=map(int,input().split())
A,x,y=map(int,input().split())
B,z,w=map(int,input().split())
MAP=[input().strip() for i in range(H)]
OK=[[[0]*W for i in range(H)] for j in range(2000)]
OK[A][x][y]=1
Q=[(A,x,y)]
while Q:
now,x,y=Q.pop()
for tx,ty in [(x+1,y),(x-1,y),(x,y+1),(x,y-1)]:
if 0<=tx<H and 0<=ty<W:
if MAP[tx][ty]==".":
if now-1>0 and OK[now-1][tx][ty]==0:
OK[now-1][tx][ty]=1
Q.append((now-1,tx,ty))
else:
if now+1<2000 and OK[now+1][tx][ty]==0:
OK[now+1][tx][ty]=1
Q.append((now+1,tx,ty))
if OK[B][z][w]==1:
print("Yes")
else:
print("No")
titia