結果

問題 No.1 道のショートカット
ユーザー 👑 hos.lyrichos.lyric
提出日時 2015-02-20 22:22:18
言語 Ruby
(3.3.0)
結果
AC  
実行時間 2,066 ms / 5,000 ms
コード長 306 bytes
コンパイル時間 62 ms
コンパイル使用メモリ 11,532 KB
実行使用メモリ 15,576 KB
最終ジャッジ日時 2023-09-27 21:40:22
合計ジャッジ時間 19,974 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 86 ms
15,328 KB
testcase_01 AC 86 ms
15,124 KB
testcase_02 AC 85 ms
15,248 KB
testcase_03 AC 83 ms
15,180 KB
testcase_04 AC 84 ms
15,312 KB
testcase_05 AC 84 ms
15,284 KB
testcase_06 AC 82 ms
15,172 KB
testcase_07 AC 85 ms
15,180 KB
testcase_08 AC 1,585 ms
15,404 KB
testcase_09 AC 831 ms
15,148 KB
testcase_10 AC 506 ms
15,284 KB
testcase_11 AC 799 ms
15,304 KB
testcase_12 AC 2,066 ms
15,548 KB
testcase_13 AC 1,994 ms
15,576 KB
testcase_14 AC 124 ms
15,076 KB
testcase_15 AC 82 ms
15,284 KB
testcase_16 AC 327 ms
15,232 KB
testcase_17 AC 85 ms
15,320 KB
testcase_18 AC 178 ms
15,156 KB
testcase_19 AC 245 ms
15,320 KB
testcase_20 AC 333 ms
15,252 KB
testcase_21 AC 332 ms
15,304 KB
testcase_22 AC 186 ms
15,276 KB
testcase_23 AC 803 ms
15,164 KB
testcase_24 AC 946 ms
15,200 KB
testcase_25 AC 409 ms
15,156 KB
testcase_26 AC 253 ms
15,128 KB
testcase_27 AC 1,380 ms
15,160 KB
testcase_28 AC 88 ms
15,048 KB
testcase_29 AC 218 ms
15,108 KB
testcase_30 AC 95 ms
15,288 KB
testcase_31 AC 109 ms
15,124 KB
testcase_32 AC 948 ms
15,336 KB
testcase_33 AC 602 ms
15,032 KB
testcase_34 AC 593 ms
15,120 KB
testcase_35 AC 87 ms
15,160 KB
testcase_36 AC 252 ms
15,368 KB
testcase_37 AC 99 ms
15,120 KB
testcase_38 AC 105 ms
15,272 KB
testcase_39 AC 247 ms
15,308 KB
testcase_40 AC 130 ms
15,272 KB
testcase_41 AC 94 ms
15,156 KB
testcase_42 AC 84 ms
15,128 KB
testcase_43 AC 83 ms
15,316 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n=gets.to_i
l=gets.to_i
m=gets.to_i
a=gets.split.map &:to_i
b=gets.split.map &:to_i
c=gets.split.map &:to_i
d=gets.split.map &:to_i
z=9**9
f=(0..n).map{[z]*(l+1)}
f[1][0]=0
n.times{
  m.times{|i|
    c[i].upto(l){|x|
      f[b[i]][x]=[f[b[i]][x],f[a[i]][x-c[i]]+d[i]].min
    }
  }
}
r=f[n].min
p r<z ?r:-1
0