結果

問題 No.1638 Robot Maze
ユーザー convexineqconvexineq
提出日時 2021-08-06 22:48:47
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 740 bytes
コンパイル時間 1,035 ms
コンパイル使用メモリ 81,440 KB
実行使用メモリ 76,956 KB
最終ジャッジ日時 2023-10-17 04:18:10
合計ジャッジ時間 6,696 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
53,300 KB
testcase_01 AC 39 ms
53,300 KB
testcase_02 AC 39 ms
53,300 KB
testcase_03 AC 83 ms
75,840 KB
testcase_04 AC 40 ms
53,424 KB
testcase_05 AC 41 ms
53,424 KB
testcase_06 AC 40 ms
53,424 KB
testcase_07 AC 40 ms
53,424 KB
testcase_08 AC 40 ms
53,424 KB
testcase_09 AC 40 ms
53,424 KB
testcase_10 AC 41 ms
53,424 KB
testcase_11 AC 40 ms
53,424 KB
testcase_12 AC 40 ms
53,424 KB
testcase_13 AC 40 ms
53,424 KB
testcase_14 AC 89 ms
75,936 KB
testcase_15 AC 83 ms
75,940 KB
testcase_16 AC 83 ms
75,940 KB
testcase_17 AC 85 ms
75,936 KB
testcase_18 AC 41 ms
53,424 KB
testcase_19 AC 79 ms
74,724 KB
testcase_20 AC 78 ms
74,728 KB
testcase_21 AC 53 ms
64,224 KB
testcase_22 AC 52 ms
64,220 KB
testcase_23 AC 53 ms
64,220 KB
testcase_24 AC 53 ms
64,224 KB
testcase_25 AC 52 ms
64,224 KB
testcase_26 AC 57 ms
68,524 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 57 ms
68,524 KB
testcase_30 AC 38 ms
53,424 KB
testcase_31 AC 38 ms
53,424 KB
testcase_32 AC 95 ms
75,936 KB
testcase_33 AC 112 ms
76,252 KB
testcase_34 AC 103 ms
76,200 KB
testcase_35 AC 117 ms
76,104 KB
testcase_36 AC 114 ms
76,292 KB
testcase_37 AC 95 ms
76,200 KB
testcase_38 AC 104 ms
76,200 KB
testcase_39 AC 105 ms
76,020 KB
testcase_40 AC 105 ms
76,200 KB
testcase_41 AC 125 ms
76,236 KB
testcase_42 AC 119 ms
76,240 KB
testcase_43 AC 127 ms
76,312 KB
testcase_44 AC 130 ms
76,420 KB
testcase_45 AC 135 ms
76,956 KB
testcase_46 AC 107 ms
76,200 KB
testcase_47 AC 97 ms
75,936 KB
testcase_48 AC 117 ms
76,264 KB
testcase_49 AC 95 ms
76,200 KB
testcase_50 AC 115 ms
76,200 KB
testcase_51 AC 119 ms
76,096 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,d,l,u]
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