結果

問題 No.1449 新プロランド
ユーザー DrDrpilotDrDrpilot
提出日時 2022-02-23 16:18:30
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 703 bytes
コンパイル時間 96 ms
コンパイル使用メモリ 10,908 KB
実行使用メモリ 8,188 KB
最終ジャッジ日時 2023-08-25 16:53:32
合計ジャッジ時間 1,666 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,004 KB
testcase_01 AC 16 ms
8,052 KB
testcase_02 AC 15 ms
8,112 KB
testcase_03 WA -
testcase_04 AC 16 ms
8,104 KB
testcase_05 AC 17 ms
8,004 KB
testcase_06 AC 16 ms
8,144 KB
testcase_07 AC 16 ms
8,048 KB
testcase_08 AC 16 ms
7,968 KB
testcase_09 AC 16 ms
8,036 KB
testcase_10 AC 16 ms
8,044 KB
testcase_11 AC 15 ms
8,040 KB
testcase_12 AC 16 ms
8,052 KB
testcase_13 AC 16 ms
8,040 KB
testcase_14 AC 16 ms
8,188 KB
testcase_15 AC 16 ms
8,168 KB
testcase_16 AC 16 ms
8,040 KB
testcase_17 AC 16 ms
8,040 KB
testcase_18 AC 16 ms
8,084 KB
testcase_19 AC 16 ms
8,072 KB
testcase_20 AC 16 ms
8,032 KB
testcase_21 AC 16 ms
8,144 KB
testcase_22 AC 16 ms
8,124 KB
testcase_23 AC 16 ms
8,032 KB
testcase_24 WA -
testcase_25 AC 16 ms
8,088 KB
testcase_26 WA -
testcase_27 AC 16 ms
8,040 KB
testcase_28 WA -
権限があれば一括ダウンロードができます

ソースコード

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')]*n
confirmed=[False]*n
q=[]
heapq.heappush(q,(0,0,0))
while q:
    now_time,now_eat,now_place=heapq.heappop(q)
    if confirmed[now_place]:
        continue
    confirmed[now_place]=True
    time[now_place]=now_time
    now_time+=t[now_place]
    now_eat+=t[now_place]
    for to_place,to_dst in g[now_place]:
        to_time=now_time+to_dst//now_eat
        if time[to_place]<=to_time:
            continue
        heapq.heappush(q,(to_time,now_eat,to_place))
print(time[-1])
0