結果
| 問題 | No.323 yuki国 |
| コンテスト | |
| ユーザー |
kuuso1
|
| 提出日時 | 2016-06-12 04:08:49 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 1,218 bytes |
| 記録 | |
| コンパイル時間 | 135 ms |
| コンパイル使用メモリ | 12,800 KB |
| 実行使用メモリ | 34,944 KB |
| 最終ジャッジ日時 | 2024-10-09 13:04:13 |
| 合計ジャッジ時間 | 99,063 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 6 |
| other | AC * 18 TLE * 14 |
ソースコード
from collections import deque
h, w = map(int,input().split())
a, si, sj = map(int,input().split())
b, gi, gj = map(int,input().split())
m = [list(input()) for i in range(h)]
maxsize = 1200
visited = [[[False] * maxsize for i in range(w)] for j in range(h)]
qi = deque([h*w*maxsize])
qj = deque([h*w*maxsize])
qsize = deque([h*w*maxsize])
visited[si][sj][a] = True
qi.append(si)
qj.append(sj)
qsize.append(a)
dx = [0, 1, 0,-1]
dy = [1, 0,-1, 0]
while len(qsize):
curi = qi.popleft()
curj = qj.popleft()
cursize = qsize.popleft()
#print(cursize,curi, curj)
for i in range(4):
nexti = curi + dx[i]
nextj = curj + dy[i]
if 0 <= nexti < h and 0 <= nextj < w:
pass
else:
continue
if m[nexti][nextj] == "*":
nextsize = cursize + 1
else:
nextsize = cursize - 1
if 0 < nextsize < maxsize:
pass
else:
continue
if not visited[nexti][nextj][nextsize]:
visited[nexti][nextj][nextsize] = True
qi.append(nexti)
qj.append(nextj)
qsize.append(nextsize)
if visited[gi][gj][b]:
print("Yes")
else:
print("No")
kuuso1