結果

問題 No.323 yuki国
ユーザー kuuso1kuuso1
提出日時 2016-06-12 04:08:49
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 4,742 ms / 5,000 ms
コード長 1,218 bytes
コンパイル時間 267 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 34,816 KB
最終ジャッジ日時 2024-04-17 18:57:52
合計ジャッジ時間 82,549 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
10,880 KB
testcase_01 AC 27 ms
10,880 KB
testcase_02 AC 24 ms
11,136 KB
testcase_03 AC 182 ms
11,648 KB
testcase_04 AC 37 ms
10,880 KB
testcase_05 AC 58 ms
11,008 KB
testcase_06 AC 38 ms
10,880 KB
testcase_07 AC 25 ms
11,008 KB
testcase_08 AC 4,599 ms
34,688 KB
testcase_09 AC 4,492 ms
34,688 KB
testcase_10 AC 25 ms
10,880 KB
testcase_11 AC 27 ms
10,880 KB
testcase_12 AC 27 ms
10,880 KB
testcase_13 AC 4,654 ms
34,560 KB
testcase_14 AC 4,426 ms
34,816 KB
testcase_15 AC 3,964 ms
34,560 KB
testcase_16 AC 4,514 ms
34,560 KB
testcase_17 AC 4,637 ms
34,560 KB
testcase_18 AC 1,433 ms
18,048 KB
testcase_19 AC 3,054 ms
25,216 KB
testcase_20 AC 4,688 ms
34,560 KB
testcase_21 AC 4,661 ms
34,688 KB
testcase_22 AC 4,742 ms
34,688 KB
testcase_23 AC 4,639 ms
34,560 KB
testcase_24 AC 3,878 ms
34,560 KB
testcase_25 AC 3,844 ms
34,688 KB
testcase_26 AC 4,716 ms
34,816 KB
testcase_27 AC 4,471 ms
34,560 KB
testcase_28 AC 4,661 ms
34,816 KB
testcase_29 AC 4,632 ms
34,688 KB
testcase_30 AC 25 ms
10,880 KB
testcase_31 AC 29 ms
10,880 KB
testcase_32 AC 36 ms
11,008 KB
testcase_33 AC 30 ms
11,008 KB
testcase_34 AC 46 ms
10,880 KB
testcase_35 AC 24 ms
10,880 KB
testcase_36 AC 38 ms
10,880 KB
testcase_37 AC 43 ms
10,880 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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")
0