結果

問題 No.2646 Cycle Maze
ユーザー hirayuu_ychirayuu_yc
提出日時 2024-02-25 19:13:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,577 ms / 2,500 ms
コード長 787 bytes
コンパイル時間 259 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 92,528 KB
最終ジャッジ日時 2024-02-25 19:13:46
合計ジャッジ時間 15,104 ms
ジャッジサーバーID
(参考情報)
judge11 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,460 KB
testcase_01 AC 36 ms
53,460 KB
testcase_02 AC 37 ms
53,460 KB
testcase_03 AC 53 ms
66,544 KB
testcase_04 AC 36 ms
53,460 KB
testcase_05 AC 36 ms
53,460 KB
testcase_06 AC 36 ms
53,460 KB
testcase_07 AC 41 ms
53,460 KB
testcase_08 AC 37 ms
53,460 KB
testcase_09 AC 37 ms
53,460 KB
testcase_10 AC 42 ms
59,712 KB
testcase_11 AC 42 ms
59,712 KB
testcase_12 AC 42 ms
53,460 KB
testcase_13 AC 37 ms
53,460 KB
testcase_14 AC 36 ms
53,460 KB
testcase_15 AC 36 ms
53,460 KB
testcase_16 AC 36 ms
53,460 KB
testcase_17 AC 36 ms
53,460 KB
testcase_18 AC 36 ms
53,460 KB
testcase_19 AC 41 ms
59,584 KB
testcase_20 AC 36 ms
53,460 KB
testcase_21 AC 36 ms
53,460 KB
testcase_22 AC 46 ms
61,972 KB
testcase_23 AC 37 ms
53,456 KB
testcase_24 AC 36 ms
53,460 KB
testcase_25 AC 116 ms
76,196 KB
testcase_26 AC 138 ms
76,460 KB
testcase_27 AC 300 ms
77,460 KB
testcase_28 AC 98 ms
76,128 KB
testcase_29 AC 108 ms
76,336 KB
testcase_30 AC 122 ms
76,464 KB
testcase_31 AC 73 ms
73,896 KB
testcase_32 AC 72 ms
73,292 KB
testcase_33 AC 163 ms
76,588 KB
testcase_34 AC 261 ms
77,728 KB
testcase_35 AC 192 ms
76,476 KB
testcase_36 AC 163 ms
76,664 KB
testcase_37 AC 185 ms
77,716 KB
testcase_38 AC 76 ms
74,488 KB
testcase_39 AC 129 ms
76,352 KB
testcase_40 AC 70 ms
73,304 KB
testcase_41 AC 156 ms
76,604 KB
testcase_42 AC 94 ms
75,964 KB
testcase_43 AC 81 ms
76,248 KB
testcase_44 AC 117 ms
76,252 KB
testcase_45 AC 544 ms
82,532 KB
testcase_46 AC 629 ms
84,080 KB
testcase_47 AC 180 ms
77,936 KB
testcase_48 AC 454 ms
81,520 KB
testcase_49 AC 569 ms
83,312 KB
testcase_50 AC 1,026 ms
87,792 KB
testcase_51 AC 1,541 ms
92,400 KB
testcase_52 AC 1,544 ms
92,528 KB
testcase_53 AC 1,539 ms
92,528 KB
testcase_54 AC 1,577 ms
92,396 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
#sys.setrecursionlimit((1<<19)-1)
#import pypyjit
#pypyjit.set_param('max_unroll_recursion=-1')

H,W,T=map(int,input().split())
Sy,Sx=map(int,input().split())
Gy,Gx=map(int,input().split())
Sy-=1
Sx-=1
Gy-=1
Gx-=1
A=[list(map(int,input())) for i in range(H)]
dp=[[0]*W for i in range(H)]
dp[Sy][Sx]=1
for i in range(T-1):
    ndp=[[0]*W for i in range(H)]
    for j in range(H):
        for k in range(W):
            if (A[j][k]-i-1)%(A[j][k]+1):
                if dp[j][k]:
                    ndp[j][k]=1
                for my,mx in ((0,1),(1,0),(0,-1),(-1,0)):
                    if 0<=my+j<H and 0<=mx+k<W:
                        if dp[my+j][mx+k]:
                            ndp[j][k]=1
    if ndp[Gy][Gx]:
        print("Yes")
        exit()
    dp=ndp
print("No")
0