結果

問題 No.323 yuki国
ユーザー titiatitia
提出日時 2023-07-26 11:31:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,333 ms / 5,000 ms
コード長 794 bytes
コンパイル時間 271 ms
コンパイル使用メモリ 82,532 KB
実行使用メモリ 305,344 KB
最終ジャッジ日時 2024-04-12 11:02:07
合計ジャッジ時間 14,352 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
62,556 KB
testcase_01 AC 45 ms
66,716 KB
testcase_02 AC 38 ms
63,868 KB
testcase_03 AC 80 ms
78,652 KB
testcase_04 AC 49 ms
69,584 KB
testcase_05 AC 62 ms
77,764 KB
testcase_06 AC 47 ms
69,656 KB
testcase_07 AC 39 ms
63,728 KB
testcase_08 AC 557 ms
126,044 KB
testcase_09 AC 509 ms
126,012 KB
testcase_10 AC 37 ms
60,928 KB
testcase_11 AC 41 ms
65,288 KB
testcase_12 AC 42 ms
66,112 KB
testcase_13 AC 419 ms
128,804 KB
testcase_14 AC 404 ms
128,456 KB
testcase_15 AC 283 ms
125,472 KB
testcase_16 AC 489 ms
125,832 KB
testcase_17 AC 757 ms
239,236 KB
testcase_18 AC 335 ms
139,164 KB
testcase_19 AC 455 ms
166,264 KB
testcase_20 AC 1,309 ms
302,048 KB
testcase_21 AC 1,303 ms
305,344 KB
testcase_22 AC 1,324 ms
301,172 KB
testcase_23 AC 1,333 ms
300,984 KB
testcase_24 AC 296 ms
125,548 KB
testcase_25 AC 320 ms
125,440 KB
testcase_26 AC 518 ms
125,532 KB
testcase_27 AC 447 ms
125,876 KB
testcase_28 AC 492 ms
125,356 KB
testcase_29 AC 490 ms
125,152 KB
testcase_30 AC 39 ms
63,244 KB
testcase_31 AC 47 ms
68,228 KB
testcase_32 AC 50 ms
71,096 KB
testcase_33 AC 45 ms
67,244 KB
testcase_34 AC 72 ms
77,892 KB
testcase_35 AC 37 ms
61,940 KB
testcase_36 AC 66 ms
77,288 KB
testcase_37 AC 52 ms
71,568 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

H,W=map(int,input().split())

A,x,y=map(int,input().split())
B,z,w=map(int,input().split())

MAP=[input().strip() for i in range(H)]

OK=[[[0]*W for i in range(H)] for j in range(2000)]

OK[A][x][y]=1

Q=[(A,x,y)]

while Q:
    now,x,y=Q.pop()

    for tx,ty in [(x+1,y),(x-1,y),(x,y+1),(x,y-1)]:
        if 0<=tx<H and 0<=ty<W:
            if MAP[tx][ty]==".":
                if now-1>0 and OK[now-1][tx][ty]==0:
                    OK[now-1][tx][ty]=1
                    Q.append((now-1,tx,ty))
            else:
                if now+1<2000 and OK[now+1][tx][ty]==0:
                    OK[now+1][tx][ty]=1
                    Q.append((now+1,tx,ty))

if OK[B][z][w]==1:
    print("Yes")
else:
    print("No")
                
                    

0