結果
| 問題 |
No.323 yuki国
|
| コンテスト | |
| ユーザー |
rlangevin
|
| 提出日時 | 2023-09-29 08:59:44 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 825 bytes |
| コンパイル時間 | 434 ms |
| コンパイル使用メモリ | 82,664 KB |
| 実行使用メモリ | 387,140 KB |
| 最終ジャッジ日時 | 2024-07-22 03:36:23 |
| 合計ジャッジ時間 | 34,499 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 6 |
| other | AC * 29 WA * 3 |
ソースコード
from collections import *
H, W = map(int, input().split())
A, sx, sy = map(int, input().split())
B, gx, gy = map(int, input().split())
G = []
for i in range(H):
G.append(list(input()))
Q = deque()
Q.append((sx, sy, A))
dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]
M = 1200
S = set()
S.add((sx, sy, A))
while Q:
px, py, c = Q.popleft()
for k in range(4):
x = px + dx[k]
y = py + dy[k]
if x < 0 or x > H - 1 or y < 0 or y > W - 1:
continue
if G[x][y] == "*":
nc = c + 1
else:
nc = c - 1
if nc < 0 or nc >= M:
continue
if (x, y, nc) in S:
continue
S.add((x, y, nc))
Q.append((x, y, nc))
if B == nc and x == gx and y == gy:
print("Yes")
exit()
print("No")
rlangevin