結果

問題 No.1638 Robot Maze
ユーザー convexineqconvexineq
提出日時 2021-08-06 22:45:54
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 740 bytes
コンパイル時間 1,460 ms
コンパイル使用メモリ 81,420 KB
実行使用メモリ 77,064 KB
最終ジャッジ日時 2023-10-17 04:15:54
合計ジャッジ時間 7,020 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,376 KB
testcase_01 AC 36 ms
53,376 KB
testcase_02 AC 36 ms
53,376 KB
testcase_03 AC 118 ms
75,784 KB
testcase_04 AC 37 ms
53,404 KB
testcase_05 AC 37 ms
53,404 KB
testcase_06 AC 37 ms
53,404 KB
testcase_07 AC 38 ms
53,404 KB
testcase_08 AC 37 ms
53,404 KB
testcase_09 AC 38 ms
53,404 KB
testcase_10 AC 37 ms
53,404 KB
testcase_11 AC 38 ms
53,404 KB
testcase_12 AC 37 ms
53,404 KB
testcase_13 AC 36 ms
53,404 KB
testcase_14 AC 88 ms
75,876 KB
testcase_15 AC 81 ms
75,888 KB
testcase_16 AC 80 ms
75,888 KB
testcase_17 AC 82 ms
75,884 KB
testcase_18 AC 38 ms
53,404 KB
testcase_19 AC 76 ms
74,708 KB
testcase_20 AC 74 ms
74,672 KB
testcase_21 AC 49 ms
64,172 KB
testcase_22 AC 49 ms
64,168 KB
testcase_23 AC 49 ms
64,168 KB
testcase_24 AC 49 ms
64,172 KB
testcase_25 AC 49 ms
64,172 KB
testcase_26 AC 54 ms
68,472 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 54 ms
68,472 KB
testcase_30 AC 37 ms
53,404 KB
testcase_31 AC 37 ms
53,404 KB
testcase_32 AC 91 ms
76,148 KB
testcase_33 AC 110 ms
76,216 KB
testcase_34 AC 102 ms
76,148 KB
testcase_35 AC 107 ms
76,148 KB
testcase_36 AC 109 ms
76,232 KB
testcase_37 AC 90 ms
75,884 KB
testcase_38 AC 93 ms
75,956 KB
testcase_39 AC 99 ms
75,968 KB
testcase_40 AC 97 ms
76,148 KB
testcase_41 AC 102 ms
76,000 KB
testcase_42 AC 107 ms
76,148 KB
testcase_43 AC 133 ms
76,948 KB
testcase_44 AC 132 ms
77,044 KB
testcase_45 AC 124 ms
77,064 KB
testcase_46 AC 100 ms
75,992 KB
testcase_47 AC 96 ms
76,148 KB
testcase_48 AC 109 ms
76,152 KB
testcase_49 AC 91 ms
76,148 KB
testcase_50 AC 111 ms
76,148 KB
testcase_51 AC 124 ms
76,244 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

h,w = map(int,input().split())
u,d,r,l,k,p = map(int,input().split())
sx,sy,gx,gy = map(int,input().split())
b = [input() for _ in range(h)]
sx -= 1
sy -= 1
gx -= 1
gy -= 1
C = [r,u,l,d]
dx = [1,0,-1,0]
dy = [0,1,0,-1]
INF = 10**18
dist = [[INF]*w for _ in range(h)]
from heapq import *
q = [(0,sx,sy)]
while q:
    dv,x,y = heappop(q)
    if dist[x][y] < dv: continue
    for i in range(4):
        nx = x + dx[i]
        ny = y + dy[i]
        if nx < 0 or nx >= h or ny < 0 or ny >= w or b[nx][ny] == "#": continue
        cost = dv + C[i]
        if b[nx][ny] == "@":
            cost += p
        if cost < dist[nx][ny]:
            heappush(q, (cost,nx,ny))
            dist[nx][ny] = cost
print("Yes" if dist[gx][gy] <= k else "No")
0