結果

問題 No.1 道のショートカット
ユーザー syaro
提出日時 2016-02-23 19:33:43
言語 Ruby
(3.4.1)
結果
AC  
実行時間 150 ms / 5,000 ms
コード長 180 bytes
コンパイル時間 227 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 12,672 KB
最終ジャッジ日時 2024-07-20 16:20:24
合計ジャッジ時間 5,600 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 40
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:5: warning: ambiguous first argument; put parentheses or a space even after `-' operator
Syntax OK

ソースコード

diff #

(n,),(c,),_,*s=$<.map{|l|l.split.map &:to_i}
d=(0..n).map{[M=$$**9]*-~c}
d[1][0]=0
s.transpose.sort.map{|s,t,y,m|y.upto(c){|j|d[t][j]=[d[t][j],d[s][j-y]+m].min}}
p -~d[n].min%-~M-1
0