結果
| 問題 |
No.1 道のショートカット
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-10-14 21:01:51 |
| 言語 | Ruby (3.4.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 245 bytes |
| コンパイル時間 | 1,059 ms |
| コンパイル使用メモリ | 8,064 KB |
| 実行使用メモリ | 13,312 KB |
| 最終ジャッジ日時 | 2025-10-14 21:01:59 |
| 合計ジャッジ時間 | 8,038 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 2 |
| other | AC * 15 WA * 25 |
コンパイルメッセージ
Syntax OK
ソースコード
N,C,V=3.times.map{gets.to_i}
dp=Array.new(N+1){Array.new(C+1){10**9+7}}
dp[1][0]=0
4.times.map{gets.split.map(&:to_i)}.transpose.sort.map{|s,t,y,m|
y.upto(C){|j| dp[t][j]=[dp[s][y-j]+m,dp[t][j]].min}
}
ans=dp[N].min
ans=-1 if ans==10**9+7
p ans