結果

問題 No.323 yuki国
ユーザー ynyn
提出日時 2016-06-11 16:53:05
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 987 bytes
コンパイル時間 311 ms
コンパイル使用メモリ 82,340 KB
実行使用メモリ 252,796 KB
最終ジャッジ日時 2024-04-17 18:48:45
合計ジャッジ時間 68,481 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,212 KB
testcase_01 AC 54 ms
63,172 KB
testcase_02 AC 38 ms
54,080 KB
testcase_03 AC 201 ms
78,464 KB
testcase_04 AC 95 ms
76,888 KB
testcase_05 AC 132 ms
77,492 KB
testcase_06 AC 96 ms
76,768 KB
testcase_07 AC 38 ms
53,440 KB
testcase_08 TLE -
testcase_09 AC 3,591 ms
247,140 KB
testcase_10 AC 37 ms
52,864 KB
testcase_11 AC 50 ms
64,580 KB
testcase_12 AC 50 ms
63,868 KB
testcase_13 AC 4,518 ms
252,528 KB
testcase_14 AC 2,482 ms
101,244 KB
testcase_15 AC 3,315 ms
227,220 KB
testcase_16 AC 3,283 ms
105,128 KB
testcase_17 AC 4,677 ms
249,796 KB
testcase_18 AC 1,311 ms
129,364 KB
testcase_19 AC 2,473 ms
183,568 KB
testcase_20 AC 3,843 ms
252,796 KB
testcase_21 AC 3,859 ms
252,740 KB
testcase_22 AC 3,816 ms
252,244 KB
testcase_23 AC 3,804 ms
252,280 KB
testcase_24 AC 3,010 ms
226,484 KB
testcase_25 AC 3,101 ms
224,724 KB
testcase_26 AC 3,656 ms
247,824 KB
testcase_27 AC 3,547 ms
250,800 KB
testcase_28 AC 3,143 ms
102,308 KB
testcase_29 AC 3,202 ms
101,488 KB
testcase_30 AC 36 ms
53,596 KB
testcase_31 AC 85 ms
76,804 KB
testcase_32 AC 122 ms
77,552 KB
testcase_33 AC 82 ms
76,660 KB
testcase_34 AC 132 ms
78,248 KB
testcase_35 AC 35 ms
53,304 KB
testcase_36 AC 106 ms
76,976 KB
testcase_37 AC 96 ms
77,036 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import heapq
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)]

visited = [[[False] * 1200 for i in range(w)] for j in range(h)]

q = []
visited[si][sj][a] = True
heapq.heappush(q, (si, sj, a))

dx = [0, 1, 0,-1]
dy = [1, 0,-1, 0]

while len(q):
    curi, curj, cursize = heapq.heappop(q)

    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 < 1200:
            pass
        else:
            continue

        if not visited[nexti][nextj][nextsize]:
            visited[nexti][nextj][nextsize] = True
            heapq.heappush(q,(nexti, nextj, nextsize))


if visited[gi][gj][b]:
    print("Yes")
else:
    print("No")
0