結果
| 問題 |
No.1449 新プロランド
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-02-23 16:18:30 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 703 bytes |
| コンパイル時間 | 127 ms |
| コンパイル使用メモリ | 12,800 KB |
| 実行使用メモリ | 10,880 KB |
| 最終ジャッジ日時 | 2024-12-24 02:08:55 |
| 合計ジャッジ時間 | 2,148 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 WA * 4 |
ソースコード
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])