結果

問題 No.27 板の準備
ユーザー letrangerjpletrangerjp
提出日時 2017-06-13 14:18:30
言語 Ruby
(3.3.0)
結果
AC  
実行時間 559 ms / 5,000 ms
コード長 288 bytes
コンパイル時間 58 ms
コンパイル使用メモリ 11,272 KB
実行使用メモリ 42,492 KB
最終ジャッジ日時 2023-08-27 04:41:43
合計ジャッジ時間 7,654 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 129 ms
17,460 KB
testcase_01 AC 178 ms
22,740 KB
testcase_02 AC 344 ms
31,720 KB
testcase_03 AC 171 ms
21,832 KB
testcase_04 AC 402 ms
40,524 KB
testcase_05 AC 357 ms
34,540 KB
testcase_06 AC 475 ms
41,324 KB
testcase_07 AC 481 ms
40,664 KB
testcase_08 AC 559 ms
42,492 KB
testcase_09 AC 483 ms
39,952 KB
testcase_10 AC 412 ms
40,052 KB
testcase_11 AC 386 ms
35,780 KB
testcase_12 AC 417 ms
41,232 KB
testcase_13 AC 378 ms
34,732 KB
testcase_14 AC 299 ms
31,200 KB
testcase_15 AC 425 ms
40,004 KB
testcase_16 AC 255 ms
28,060 KB
testcase_17 AC 404 ms
35,072 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

V = gets.split.take(4).map(&:to_i)

$dp = {}
def f(v, a, b, c)
  $dp[[v,a,b,c]] ||= if v < 0
    1.0/0
  elsif v == 0
    0
  else
    [a, b, c].map{|d| f(v - d, a, b, c) }.min + 1
  end
end

p [*1..30].combination(3).inject(1.0/0){|r, (a, b, c)|
  [r, V.map{|v|f(v, a, b, c)}.sum].min
}
0