結果
| 問題 |
No.323 yuki国
|
| コンテスト | |
| ユーザー |
brthyyjp
|
| 提出日時 | 2022-01-05 10:27:19 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,063 bytes |
| コンパイル時間 | 1,519 ms |
| コンパイル使用メモリ | 82,048 KB |
| 実行使用メモリ | 109,824 KB |
| 最終ジャッジ日時 | 2024-10-15 14:42:34 |
| 合計ジャッジ時間 | 13,871 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 6 |
| other | AC * 30 WA * 2 |
ソースコード
import sys
import io, os
input = sys.stdin.readline
def main():
h, w = map(int, input().split())
a, si, sj = map(int, input().split())
b, ti, tj = map(int, input().split())
M = [str(input().rstrip()) for i in range(h)]
visit = [[False]*1051 for i in range(h*w)]
from collections import deque
q = deque([])
s = si*w+sj
t = ti*w+tj
q.append((s, a))
visit[s][a] = True
while q:
v, x = q.popleft()
if v == t and x == b:
break
i, j = divmod(v, w)
for di, dj in (-1, 0), (1, 0), (0, 1), (0, -1):
ni, nj = i+di, j+dj
if 0 <= ni < h and 0 <= nj < w:
nv = ni*w+nj
if M[ni][nj] == '*':
nx = x+1
else:
nx = x-1
if nx >= 1 and nx <= 1050 and not visit[nv][nx]:
q.append((nv, nx))
visit[nv][nx] = True
if visit[t][b]:
print('Yes')
else:
print('No')
if __name__ == '__main__':
main()
brthyyjp