結果
問題 | No.1 道のショートカット |
ユーザー |
![]() |
提出日時 | 2024-03-12 13:09:29 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 61 ms / 5,000 ms |
コード長 | 359 bytes |
コンパイル時間 | 375 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 64,000 KB |
最終ジャッジ日時 | 2024-09-29 22:17:07 |
合計ジャッジ時間 | 4,319 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 40 |
ソースコード
n=int(input()) c=int(input()) v=int(input()) f=lambda:map(int,input().split()) g=[[]for i in range(n)] for s,t,y,m in zip(f(),f(),f(),f()):g[t-1].append((s-1,y,m)) dp=[-~c*[1<<20]for i in range(n)] dp[0][0]=0 for i in range(n): for j,k,l in g[i]: for m in range(k,c+1):dp[i][m]=min(dp[i][m],dp[j][m-k]+l) r=min(dp[-1]) print(r if r<1<<20 else -1)