結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,460 KB
testcase_01 AC 38 ms
53,460 KB
testcase_02 AC 38 ms
53,460 KB
testcase_03 AC 47 ms
62,244 KB
testcase_04 AC 38 ms
53,460 KB
testcase_05 AC 37 ms
53,460 KB
testcase_06 WA -
testcase_07 AC 38 ms
53,460 KB
testcase_08 AC 38 ms
53,460 KB
testcase_09 AC 38 ms
53,460 KB
testcase_10 AC 38 ms
53,460 KB
testcase_11 AC 39 ms
53,460 KB
testcase_12 WA -
testcase_13 AC 39 ms
53,460 KB
testcase_14 AC 39 ms
53,460 KB
testcase_15 AC 38 ms
53,460 KB
testcase_16 WA -
testcase_17 AC 38 ms
53,460 KB
testcase_18 WA -
testcase_19 AC 39 ms
53,460 KB
testcase_20 AC 38 ms
53,460 KB
testcase_21 AC 39 ms
53,460 KB
testcase_22 AC 41 ms
59,344 KB
testcase_23 AC 38 ms
53,460 KB
testcase_24 AC 38 ms
53,460 KB
testcase_25 AC 84 ms
76,092 KB
testcase_26 AC 108 ms
76,088 KB
testcase_27 AC 209 ms
76,716 KB
testcase_28 AC 76 ms
72,780 KB
testcase_29 AC 76 ms
74,176 KB
testcase_30 AC 87 ms
75,968 KB
testcase_31 AC 49 ms
64,304 KB
testcase_32 AC 57 ms
66,404 KB
testcase_33 AC 95 ms
76,044 KB
testcase_34 AC 158 ms
76,692 KB
testcase_35 AC 137 ms
76,096 KB
testcase_36 AC 112 ms
76,096 KB
testcase_37 AC 94 ms
76,448 KB
testcase_38 AC 59 ms
66,424 KB
testcase_39 AC 99 ms
75,968 KB
testcase_40 AC 50 ms
62,236 KB
testcase_41 AC 110 ms
76,096 KB
testcase_42 AC 88 ms
75,828 KB
testcase_43 AC 65 ms
70,720 KB
testcase_44 AC 91 ms
75,840 KB
testcase_45 AC 418 ms
79,604 KB
testcase_46 AC 396 ms
79,468 KB
testcase_47 AC 82 ms
76,916 KB
testcase_48 AC 266 ms
78,580 KB
testcase_49 AC 361 ms
79,216 KB
testcase_50 AC 804 ms
82,916 KB
testcase_51 AC 1,503 ms
88,808 KB
testcase_52 AC 1,517 ms
88,936 KB
testcase_53 AC 1,525 ms
89,188 KB
testcase_54 AC 1,613 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):
    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