結果

問題 No.1449 新プロランド
ユーザー DrDrpilotDrDrpilot
提出日時 2022-02-23 16:45:37
言語 PyPy3
(7.3.15)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 730 bytes
コンパイル時間 289 ms
コンパイル使用メモリ 86,916 KB
実行使用メモリ 80,100 KB
最終ジャッジ日時 2023-08-25 16:53:43
合計ジャッジ時間 5,680 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
71,336 KB
testcase_01 AC 111 ms
77,556 KB
testcase_02 AC 141 ms
77,824 KB
testcase_03 AC 81 ms
71,280 KB
testcase_04 AC 107 ms
76,520 KB
testcase_05 AC 196 ms
79,756 KB
testcase_06 AC 188 ms
79,168 KB
testcase_07 AC 158 ms
78,616 KB
testcase_08 AC 172 ms
79,304 KB
testcase_09 AC 206 ms
79,616 KB
testcase_10 AC 166 ms
79,024 KB
testcase_11 AC 147 ms
78,264 KB
testcase_12 AC 152 ms
78,736 KB
testcase_13 AC 177 ms
78,864 KB
testcase_14 AC 118 ms
77,964 KB
testcase_15 AC 185 ms
79,048 KB
testcase_16 AC 168 ms
78,732 KB
testcase_17 AC 175 ms
79,088 KB
testcase_18 AC 75 ms
71,076 KB
testcase_19 AC 75 ms
71,376 KB
testcase_20 AC 73 ms
71,192 KB
testcase_21 AC 114 ms
77,728 KB
testcase_22 AC 118 ms
78,040 KB
testcase_23 AC 155 ms
79,048 KB
testcase_24 AC 188 ms
78,980 KB
testcase_25 WA -
testcase_26 AC 102 ms
76,532 KB
testcase_27 AC 208 ms
80,100 KB
testcase_28 AC 214 ms
79,456 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import heapq
n,m=map(int,input().split())
g=[[] for _ in range(n)]
for _ in range(m):
    a,b,c=map(int,input().split())
    g[a-1].append((b-1,c))
    g[b-1].append((a-1,c))
t=list(map(int,input().split()))
time=[[float('inf')]*501 for _ in range(n)]
time[0][0]=0
q=[(0,0,0)]
while q:
    now_time,now_place,eat_time=heapq.heappop(q)
    if time[now_place][eat_time]<now_time:
        continue
    now_time+=t[now_place]
    eat_time=min(eat_time+t[now_place],500)
    for to_place,to_dst in g[now_place]:
        if time[to_place][eat_time]>now_time+to_dst//eat_time:
            time[to_place][eat_time]=now_time+to_dst//eat_time
            heapq.heappush(q,(now_time+to_dst//eat_time,to_place,eat_time))
print(min(time[n-1]))
0