結果

問題 No.1449 新プロランド
ユーザー DrDrpilotDrDrpilot
提出日時 2022-02-23 16:44:36
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 730 bytes
コンパイル時間 144 ms
コンパイル使用メモリ 10,856 KB
実行使用メモリ 9,836 KB
最終ジャッジ日時 2023-08-25 16:53:44
合計ジャッジ時間 2,215 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
8,168 KB
testcase_01 AC 21 ms
7,992 KB
testcase_02 AC 27 ms
8,144 KB
testcase_03 AC 17 ms
8,076 KB
testcase_04 AC 18 ms
7,988 KB
testcase_05 AC 52 ms
9,272 KB
testcase_06 AC 43 ms
9,100 KB
testcase_07 AC 29 ms
8,576 KB
testcase_08 AC 41 ms
8,996 KB
testcase_09 AC 59 ms
8,764 KB
testcase_10 AC 34 ms
8,760 KB
testcase_11 AC 25 ms
8,476 KB
testcase_12 AC 31 ms
8,816 KB
testcase_13 AC 59 ms
8,808 KB
testcase_14 AC 21 ms
8,496 KB
testcase_15 AC 49 ms
9,184 KB
testcase_16 AC 33 ms
8,756 KB
testcase_17 AC 39 ms
8,880 KB
testcase_18 AC 16 ms
8,136 KB
testcase_19 AC 17 ms
8,488 KB
testcase_20 AC 16 ms
8,068 KB
testcase_21 AC 21 ms
8,524 KB
testcase_22 AC 20 ms
7,988 KB
testcase_23 AC 31 ms
8,892 KB
testcase_24 AC 53 ms
8,492 KB
testcase_25 WA -
testcase_26 AC 19 ms
8,128 KB
testcase_27 AC 82 ms
9,836 KB
testcase_28 AC 82 ms
9,184 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