結果

問題 No.1638 Robot Maze
ユーザー lloyzlloyz
提出日時 2023-08-06 19:04:46
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 902 bytes
コンパイル時間 349 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 69,248 KB
最終ジャッジ日時 2024-04-24 13:49:00
合計ジャッジ時間 4,269 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
54,144 KB
testcase_01 AC 36 ms
53,760 KB
testcase_02 AC 35 ms
54,144 KB
testcase_03 AC 54 ms
66,032 KB
testcase_04 AC 42 ms
54,144 KB
testcase_05 AC 40 ms
53,888 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 48 ms
54,144 KB
testcase_09 AC 48 ms
53,888 KB
testcase_10 AC 46 ms
54,016 KB
testcase_11 AC 44 ms
53,632 KB
testcase_12 AC 43 ms
53,632 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 56 ms
65,408 KB
testcase_16 AC 55 ms
65,152 KB
testcase_17 WA -
testcase_18 AC 48 ms
60,288 KB
testcase_19 AC 60 ms
65,408 KB
testcase_20 AC 58 ms
65,024 KB
testcase_21 AC 46 ms
59,904 KB
testcase_22 AC 55 ms
60,160 KB
testcase_23 WA -
testcase_24 AC 46 ms
60,288 KB
testcase_25 AC 46 ms
60,288 KB
testcase_26 AC 52 ms
62,336 KB
testcase_27 AC 47 ms
60,544 KB
testcase_28 AC 47 ms
60,288 KB
testcase_29 AC 48 ms
60,544 KB
testcase_30 WA -
testcase_31 AC 41 ms
54,016 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 65 ms
67,584 KB
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 AC 46 ms
59,904 KB
testcase_43 AC 50 ms
60,160 KB
testcase_44 AC 47 ms
59,776 KB
testcase_45 AC 46 ms
60,032 KB
testcase_46 AC 46 ms
59,904 KB
testcase_47 AC 48 ms
59,776 KB
testcase_48 AC 48 ms
60,032 KB
testcase_49 AC 46 ms
60,288 KB
testcase_50 AC 48 ms
60,160 KB
testcase_51 AC 46 ms
60,032 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque

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
Que = deque([(si, sj)])
while Que:
    ci, cj = Que.popleft()
    cc = DP[ci][cj]
    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
            Que.append((ni, nj))
if DP[ti][tj] == k + 1:
    print("No")
else:
    print("Yes")
0