結果

問題 No.1638 Robot Maze
ユーザー lloyzlloyz
提出日時 2023-08-06 20:36:17
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 927 bytes
コンパイル時間 190 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 77,184 KB
最終ジャッジ日時 2024-04-24 15:12:52
合計ジャッジ時間 4,545 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
52,352 KB
testcase_01 AC 44 ms
52,736 KB
testcase_02 AC 42 ms
52,736 KB
testcase_03 AC 95 ms
76,800 KB
testcase_04 AC 43 ms
52,736 KB
testcase_05 AC 43 ms
52,480 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 44 ms
52,736 KB
testcase_09 AC 42 ms
52,608 KB
testcase_10 AC 44 ms
53,376 KB
testcase_11 AC 44 ms
53,248 KB
testcase_12 AC 44 ms
52,864 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 82 ms
70,784 KB
testcase_16 AC 81 ms
70,784 KB
testcase_17 WA -
testcase_18 AC 51 ms
59,008 KB
testcase_19 AC 76 ms
69,504 KB
testcase_20 AC 81 ms
69,248 KB
testcase_21 AC 48 ms
58,880 KB
testcase_22 AC 48 ms
59,136 KB
testcase_23 WA -
testcase_24 AC 50 ms
59,136 KB
testcase_25 AC 49 ms
59,392 KB
testcase_26 AC 55 ms
62,080 KB
testcase_27 AC 52 ms
59,520 KB
testcase_28 AC 52 ms
59,136 KB
testcase_29 AC 51 ms
59,520 KB
testcase_30 WA -
testcase_31 AC 45 ms
52,608 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 90 ms
74,752 KB
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 AC 49 ms
58,880 KB
testcase_43 AC 50 ms
58,752 KB
testcase_44 AC 48 ms
58,880 KB
testcase_45 AC 46 ms
58,880 KB
testcase_46 AC 46 ms
58,880 KB
testcase_47 AC 47 ms
59,008 KB
testcase_48 AC 49 ms
59,136 KB
testcase_49 AC 52 ms
59,264 KB
testcase_50 AC 51 ms
58,880 KB
testcase_51 AC 51 ms
58,880 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heappop, heappush

h, w = map(int, input().split())
u, d, r, l, k, p = map(int, input().split())
si, sj, ti, tj = map(int, input().split())
si -= 1
sj -= 1
ti -= 1
tj -= 1
S = [list(input()) for _ in range(h)]

DP = [[k + 1 for _ in range(w)] for _ in range(h)]
Directions = [(-1, 0), (1, 0), (0, 1), (-1, 0)]
C = [u, d, r, l]
DP[si][sj] = 0
H = [(0, si, sj)]
while H:
    cc, ci, cj = heappop(H)
    if cc > DP[ci][cj]:
        continue
    for i in range(4):
        nc = cc
        di, dj = Directions[i]
        ni, nj = ci + di, cj + dj
        if 0 <= ni < h and 0 <= nj < w:
            if S[ni][nj] == '#':
                continue
            elif S[ni][nj] == '@':
                nc += p
            nc += C[i]
            if nc >= DP[ni][nj]:
                continue
            DP[ni][nj] = nc
            heappush(H, (nc, ni, nj))
if DP[ti][tj] == k + 1:
    print("No")
else:
    print("Yes")
0