結果

問題 No.1638 Robot Maze
ユーザー convexineqconvexineq
提出日時 2021-08-06 22:40:02
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 835 bytes
コンパイル時間 171 ms
コンパイル使用メモリ 81,848 KB
実行使用メモリ 78,572 KB
最終ジャッジ日時 2023-10-17 04:07:45
合計ジャッジ時間 6,289 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,568 KB
testcase_01 AC 35 ms
53,568 KB
testcase_02 AC 33 ms
53,568 KB
testcase_03 AC 101 ms
76,148 KB
testcase_04 AC 40 ms
53,568 KB
testcase_05 AC 33 ms
53,568 KB
testcase_06 AC 33 ms
53,568 KB
testcase_07 AC 33 ms
53,568 KB
testcase_08 AC 34 ms
53,568 KB
testcase_09 AC 34 ms
53,568 KB
testcase_10 AC 34 ms
53,568 KB
testcase_11 AC 35 ms
53,568 KB
testcase_12 AC 37 ms
53,568 KB
testcase_13 AC 35 ms
53,568 KB
testcase_14 AC 134 ms
77,272 KB
testcase_15 AC 98 ms
76,408 KB
testcase_16 AC 100 ms
76,408 KB
testcase_17 AC 102 ms
76,412 KB
testcase_18 AC 38 ms
55,616 KB
testcase_19 AC 102 ms
76,500 KB
testcase_20 AC 102 ms
76,500 KB
testcase_21 AC 48 ms
64,416 KB
testcase_22 AC 48 ms
64,416 KB
testcase_23 AC 48 ms
64,416 KB
testcase_24 AC 47 ms
64,416 KB
testcase_25 AC 46 ms
64,416 KB
testcase_26 AC 51 ms
68,720 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 54 ms
68,720 KB
testcase_30 AC 34 ms
53,568 KB
testcase_31 AC 36 ms
53,568 KB
testcase_32 AC 137 ms
77,348 KB
testcase_33 AC 156 ms
77,696 KB
testcase_34 AC 172 ms
78,048 KB
testcase_35 AC 154 ms
77,804 KB
testcase_36 AC 162 ms
77,532 KB
testcase_37 AC 142 ms
77,276 KB
testcase_38 AC 121 ms
77,096 KB
testcase_39 AC 170 ms
77,696 KB
testcase_40 AC 151 ms
77,364 KB
testcase_41 AC 176 ms
77,932 KB
testcase_42 AC 163 ms
77,816 KB
testcase_43 AC 137 ms
77,332 KB
testcase_44 AC 193 ms
78,076 KB
testcase_45 AC 119 ms
76,496 KB
testcase_46 AC 182 ms
78,048 KB
testcase_47 AC 157 ms
77,432 KB
testcase_48 AC 173 ms
77,400 KB
testcase_49 AC 120 ms
77,228 KB
testcase_50 AC 165 ms
78,572 KB
testcase_51 AC 172 ms
78,124 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)]
#dist[sx][sy] = used[sx][sy] = 0
from heapq import *
q = [(0,sx,sy)]
ans = INF
while q:
    dv,x,y = heappop(q)
    if x==gx and y==gy:
        ans = min(ans,dv)
    if dist[x][y] <= dv: continue
    dist[x][y] = min(dist[x][y],dv)
    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 = C[i]
        if b[nx][ny] == "@":
            cost += p
        if dist[nx][ny] <= dv+cost: continue
        heappush(q, (dv+cost,nx,ny))
print("Yes" if ans <= k else "No")
0