結果
| 問題 |
No.2916 累進コスト最小化
|
| コンテスト | |
| ユーザー |
titia
|
| 提出日時 | 2024-10-30 04:30:02 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 603 bytes |
| コンパイル時間 | 279 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 22,016 KB |
| 最終ジャッジ日時 | 2024-10-30 04:30:20 |
| 合計ジャッジ時間 | 18,040 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 25 TLE * 2 -- * 7 |
ソースコード
import sys
input = sys.stdin.readline
from heapq import heappop,heappush
N,M,C=map(int,input().split())
E=[[] for i in range(N)]
for i in range(M):
x,y,r,w=map(int,input().split())
x-=1
y-=1
E[x].append((y,r,w))
E[y].append((x,r,w))
ANS=[]
for i in range(1,C+1):
DP=[-1]*N
DP[0]=i
Q=[(-i,0)]
while Q:
now,ind=heappop(Q)
if DP[ind]!=-now:
continue
now=-now
for to,r,w in E[ind]:
if DP[to]<now-(now//r+w):
DP[to]=now-(now//r+w)
heappush(Q,(-DP[to],to))
print(DP[-1])
titia