結果

問題 No.323 yuki国
ユーザー rlangevinrlangevin
提出日時 2023-09-29 08:59:44
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 825 bytes
コンパイル時間 264 ms
コンパイル使用メモリ 87,180 KB
実行使用メモリ 387,844 KB
最終ジャッジ日時 2023-09-29 09:00:26
合計ジャッジ時間 40,033 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 95 ms
71,512 KB
testcase_01 AC 112 ms
71,648 KB
testcase_02 AC 128 ms
78,204 KB
testcase_03 AC 101 ms
76,324 KB
testcase_04 AC 95 ms
71,776 KB
testcase_05 AC 124 ms
78,480 KB
testcase_06 WA -
testcase_07 AC 95 ms
71,704 KB
testcase_08 AC 2,678 ms
387,828 KB
testcase_09 AC 2,379 ms
339,416 KB
testcase_10 AC 92 ms
71,700 KB
testcase_11 AC 131 ms
77,948 KB
testcase_12 AC 113 ms
77,948 KB
testcase_13 AC 2,204 ms
331,608 KB
testcase_14 AC 2,700 ms
387,712 KB
testcase_15 AC 1,791 ms
292,752 KB
testcase_16 AC 2,633 ms
387,672 KB
testcase_17 AC 2,422 ms
324,080 KB
testcase_18 AC 135 ms
78,616 KB
testcase_19 AC 1,477 ms
292,480 KB
testcase_20 AC 164 ms
83,160 KB
testcase_21 AC 2,997 ms
337,472 KB
testcase_22 AC 712 ms
154,928 KB
testcase_23 AC 2,936 ms
337,412 KB
testcase_24 AC 262 ms
95,760 KB
testcase_25 AC 2,009 ms
324,768 KB
testcase_26 AC 268 ms
96,220 KB
testcase_27 AC 2,511 ms
387,844 KB
testcase_28 AC 2,530 ms
331,240 KB
testcase_29 AC 2,542 ms
334,284 KB
testcase_30 AC 94 ms
71,784 KB
testcase_31 AC 119 ms
78,056 KB
testcase_32 AC 126 ms
78,060 KB
testcase_33 AC 116 ms
77,908 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 124 ms
78,052 KB
testcase_37 AC 97 ms
71,428 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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