結果
問題 |
No.2916 累進コスト最小化
|
ユーザー |
![]() |
提出日時 | 2024-10-30 04:22:42 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 530 bytes |
コンパイル時間 | 598 ms |
コンパイル使用メモリ | 82,784 KB |
実行使用メモリ | 82,688 KB |
最終ジャッジ日時 | 2024-10-30 04:22:51 |
合計ジャッジ時間 | 8,660 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 33 WA * 1 |
ソースコード
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)) ANS=[] for i in range(1,C+1): DP=[-1]*N DP[0]=i Q=[(-i,0)] while Q: now,ind=heappop(Q) 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])