結果

問題 No.2646 Cycle Maze
ユーザー 👑 rin204rin204
提出日時 2024-03-16 15:03:54
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,611 ms / 2,500 ms
コード長 842 bytes
コンパイル時間 195 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 89,188 KB
最終ジャッジ日時 2024-03-16 15:04:08
合計ジャッジ時間 13,501 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,460 KB
testcase_01 AC 37 ms
53,460 KB
testcase_02 AC 37 ms
53,460 KB
testcase_03 AC 45 ms
62,240 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 39 ms
53,460 KB
testcase_08 AC 39 ms
53,460 KB
testcase_09 AC 37 ms
53,460 KB
testcase_10 AC 37 ms
53,460 KB
testcase_11 AC 37 ms
53,460 KB
testcase_12 AC 38 ms
53,460 KB
testcase_13 AC 36 ms
53,460 KB
testcase_14 AC 36 ms
53,460 KB
testcase_15 AC 37 ms
53,460 KB
testcase_16 AC 37 ms
53,460 KB
testcase_17 AC 36 ms
53,460 KB
testcase_18 AC 36 ms
53,460 KB
testcase_19 AC 37 ms
53,456 KB
testcase_20 AC 37 ms
53,460 KB
testcase_21 AC 37 ms
53,460 KB
testcase_22 AC 41 ms
59,344 KB
testcase_23 AC 37 ms
53,460 KB
testcase_24 AC 38 ms
53,460 KB
testcase_25 AC 81 ms
76,092 KB
testcase_26 AC 104 ms
76,088 KB
testcase_27 AC 202 ms
76,716 KB
testcase_28 AC 75 ms
72,780 KB
testcase_29 AC 75 ms
74,176 KB
testcase_30 AC 85 ms
75,968 KB
testcase_31 AC 52 ms
64,300 KB
testcase_32 AC 55 ms
66,404 KB
testcase_33 AC 92 ms
76,044 KB
testcase_34 AC 155 ms
76,692 KB
testcase_35 AC 136 ms
76,096 KB
testcase_36 AC 105 ms
76,096 KB
testcase_37 AC 93 ms
76,448 KB
testcase_38 AC 58 ms
66,424 KB
testcase_39 AC 97 ms
75,968 KB
testcase_40 AC 49 ms
62,232 KB
testcase_41 AC 108 ms
76,096 KB
testcase_42 AC 87 ms
75,828 KB
testcase_43 AC 65 ms
70,720 KB
testcase_44 AC 116 ms
75,840 KB
testcase_45 AC 395 ms
79,604 KB
testcase_46 AC 414 ms
79,468 KB
testcase_47 AC 82 ms
76,916 KB
testcase_48 AC 265 ms
78,580 KB
testcase_49 AC 377 ms
79,344 KB
testcase_50 AC 793 ms
82,916 KB
testcase_51 AC 1,518 ms
88,808 KB
testcase_52 AC 1,536 ms
88,936 KB
testcase_53 AC 1,538 ms
89,188 KB
testcase_54 AC 1,611 ms
89,024 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

h, w, T = map(int, input().split())
si, sj = map(int, input().split())
gi, gj = map(int, input().split())
si -= 1
sj -= 1
gi -= 1
gj -= 1
A = [list(map(int, input())) for _ in range(h)]
dp = [[False] * w for _ in range(h)]
dp[si][sj] = True


di = [0, 1, 0, -1, 0]
dj = [1, 0, -1, 0, 0]
for t in range(T - 1):
    ndp = [[False] * w for _ in range(h)]
    for i in range(h):
        for j in range(w):
            if not dp[i][j]:
                continue
            for k in range(5):
                ni = i + di[k]
                nj = j + dj[k]
                if ni < 0 or ni >= h or nj < 0 or nj >= w:
                    continue
                b = (A[ni][nj] - t - 1) % (A[ni][nj] + 1)
                if b != 0:
                    ndp[ni][nj] = True
    dp = ndp
    if dp[gi][gj]:
        print("Yes")
        exit()

print("No")
0