結果

問題 No.424 立体迷路
ユーザー ヒッキープログラミングするスレヒッキープログラミングするスレ
提出日時 2016-09-23 00:10:16
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 872 bytes
コンパイル時間 106 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-04-28 20:02:00
合計ジャッジ時間 1,740 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
10,752 KB
testcase_01 WA -
testcase_02 RE -
testcase_03 WA -
testcase_04 RE -
testcase_05 RE -
testcase_06 AC 31 ms
10,880 KB
testcase_07 WA -
testcase_08 AC 31 ms
10,880 KB
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

h, w = list(map(int, input().split()))
sy, sx, gy, gx = list(map(int, input().split()))
b = []
for _ in range(h):
    b.append(input().strip())

f = [[True] * w for _ in range(h)]

t = [[sy - 1, sx - 1]]
f[sy - 1][sx - 1] = False

while len(t) > 0:
    s = []
    for y, x in t:
        if x > 0:
            if f[y][x - 1]:
                f[y][x - 1] = False
                s.append([y, x - 1])
        if y > 0:
            if f[y - 1][x]:
                f[y - 1][x] = False
                s.append([y - 1, x])
        if x < w - 1:
            if f[y][x + 1]:
                f[y][x + 1] = False
                s.appen([y, x + 1])
        if y < h - 1:
            if f[y + 1][x]:
                f[y + 1][x] = False
                s.append([y + 1, x])
    t = s
    if f[gy - 1][gx - 1] == False:
        break

print('NO' if f[gy - 1][gx - 1] else 'YES')
    
0