結果

問題 No.2646 Cycle Maze
ユーザー titiatitia
提出日時 2024-02-26 01:01:35
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 888 bytes
コンパイル時間 265 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 183,768 KB
最終ジャッジ日時 2024-02-26 01:01:52
合計ジャッジ時間 15,493 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,460 KB
testcase_01 AC 37 ms
53,460 KB
testcase_02 AC 36 ms
53,460 KB
testcase_03 AC 57 ms
68,572 KB
testcase_04 AC 37 ms
53,460 KB
testcase_05 AC 36 ms
53,460 KB
testcase_06 WA -
testcase_07 AC 36 ms
53,460 KB
testcase_08 AC 35 ms
53,460 KB
testcase_09 AC 38 ms
53,460 KB
testcase_10 AC 39 ms
53,460 KB
testcase_11 AC 38 ms
53,460 KB
testcase_12 WA -
testcase_13 AC 39 ms
53,460 KB
testcase_14 AC 36 ms
53,460 KB
testcase_15 AC 37 ms
53,460 KB
testcase_16 WA -
testcase_17 AC 35 ms
53,460 KB
testcase_18 WA -
testcase_19 AC 38 ms
53,460 KB
testcase_20 AC 35 ms
53,460 KB
testcase_21 AC 35 ms
53,460 KB
testcase_22 AC 44 ms
62,096 KB
testcase_23 AC 36 ms
53,460 KB
testcase_24 AC 36 ms
53,460 KB
testcase_25 AC 104 ms
76,564 KB
testcase_26 AC 135 ms
77,344 KB
testcase_27 AC 266 ms
81,796 KB
testcase_28 AC 101 ms
76,112 KB
testcase_29 AC 101 ms
76,704 KB
testcase_30 AC 106 ms
76,448 KB
testcase_31 AC 63 ms
73,108 KB
testcase_32 AC 66 ms
73,416 KB
testcase_33 AC 139 ms
77,960 KB
testcase_34 AC 229 ms
81,412 KB
testcase_35 AC 171 ms
77,844 KB
testcase_36 AC 142 ms
77,316 KB
testcase_37 AC 151 ms
78,340 KB
testcase_38 AC 75 ms
76,252 KB
testcase_39 AC 121 ms
76,576 KB
testcase_40 AC 61 ms
70,688 KB
testcase_41 AC 136 ms
77,344 KB
testcase_42 AC 102 ms
76,484 KB
testcase_43 AC 82 ms
76,384 KB
testcase_44 AC 100 ms
76,352 KB
testcase_45 AC 545 ms
104,792 KB
testcase_46 AC 567 ms
106,072 KB
testcase_47 AC 136 ms
80,472 KB
testcase_48 AC 438 ms
96,472 KB
testcase_49 AC 498 ms
103,896 KB
testcase_50 AC 1,036 ms
135,256 KB
testcase_51 AC 1,800 ms
182,744 KB
testcase_52 AC 1,819 ms
178,776 KB
testcase_53 AC 1,623 ms
183,768 KB
testcase_54 AC 1,806 ms
181,080 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

H,W,T=map(int,input().split())
sx,sy=map(int,input().split())
gx,gy=map(int,input().split())

sx-=1
sy-=1
gx-=1
gy-=1

MAP=[input().strip() for i in range(H)]
OK=[[0]*W for i in range(H)]
OK[sx][sy]=1

for turns in range(1,T+1):
    A=[[0]*W for i in range(H)]
    
    for i in range(H):
        for j in range(W):
            if MAP[i][j]!="0":
                A[i][j]=(int(MAP[i][j])-turns)%(1+int(MAP[i][j]))

    #print("!",A)
    OK2=[[0]*W for i in range(H)]

    for i in range(H):
        for j in range(W):
            if OK[i][j]==1:
                for z,w in [(i,j),(i+1,j),(i-1,j),(i,j+1),(i,j-1)]:
                    if 0<=z<H and 0<=w<W and A[z][w]>0:
                        OK2[z][w]=1

    OK=OK2

    if OK[gx][gy]==1:
        print("Yes")
        exit()

    #print(OK)

print("No")
                        

    
            
0