結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
8,040 KB
testcase_01 AC 25 ms
8,068 KB
testcase_02 AC 37 ms
8,140 KB
testcase_03 AC 18 ms
8,188 KB
testcase_04 AC 22 ms
8,132 KB
testcase_05 AC 199 ms
10,856 KB
testcase_06 AC 133 ms
9,780 KB
testcase_07 AC 67 ms
9,332 KB
testcase_08 AC 134 ms
10,360 KB
testcase_09 AC 96 ms
9,044 KB
testcase_10 AC 71 ms
9,480 KB
testcase_11 AC 34 ms
9,040 KB
testcase_12 AC 116 ms
10,148 KB
testcase_13 AC 100 ms
9,064 KB
testcase_14 AC 32 ms
9,156 KB
testcase_15 AC 146 ms
10,224 KB
testcase_16 AC 95 ms
9,220 KB
testcase_17 AC 105 ms
9,552 KB
testcase_18 AC 16 ms
7,992 KB
testcase_19 AC 17 ms
8,692 KB
testcase_20 AC 16 ms
8,056 KB
testcase_21 AC 44 ms
9,136 KB
testcase_22 AC 32 ms
8,036 KB
testcase_23 AC 60 ms
9,304 KB
testcase_24 AC 80 ms
8,984 KB
testcase_25 WA -
testcase_26 AC 21 ms
8,064 KB
testcase_27 AC 207 ms
11,096 KB
testcase_28 AC 145 ms
9,612 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')]*1001 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],1000)
    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