結果

問題 No.2232 Miser's Gift
ユーザー s0919s0919
提出日時 2023-03-03 23:32:59
言語 Ruby
(3.3.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 364 bytes
コンパイル時間 431 ms
コンパイル使用メモリ 11,968 KB
実行使用メモリ 99,692 KB
最終ジャッジ日時 2023-10-18 03:45:21
合計ジャッジ時間 12,002 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 87 ms
16,132 KB
testcase_01 AC 88 ms
16,132 KB
testcase_02 AC 89 ms
16,132 KB
testcase_03 TLE -
testcase_04 AC 1,553 ms
96,508 KB
testcase_05 AC 278 ms
24,224 KB
testcase_06 AC 88 ms
16,132 KB
testcase_07 AC 189 ms
18,892 KB
testcase_08 TLE -
testcase_09 TLE -
testcase_10 TLE -
testcase_11 TLE -
testcase_12 TLE -
testcase_13 TLE -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 TLE -
testcase_17 TLE -
testcase_18 TLE -
testcase_19 TLE -
testcase_20 TLE -
testcase_21 TLE -
testcase_22 TLE -
testcase_23 AC 1,998 ms
96,508 KB
testcase_24 TLE -
testcase_25 AC 1,998 ms
96,508 KB
testcase_26 AC 1,993 ms
96,504 KB
testcase_27 AC 1,994 ms
96,508 KB
testcase_28 AC 1,868 ms
96,508 KB
testcase_29 AC 1,870 ms
96,508 KB
testcase_30 AC 1,869 ms
96,508 KB
testcase_31 AC 1,885 ms
96,508 KB
testcase_32 AC 1,881 ms
96,508 KB
testcase_33 TLE -
testcase_34 TLE -
testcase_35 TLE -
testcase_36 TLE -
testcase_37 TLE -
testcase_38 AC 108 ms
16,920 KB
testcase_39 AC 108 ms
16,920 KB
testcase_40 AC 108 ms
16,920 KB
testcase_41 AC 108 ms
16,920 KB
testcase_42 AC 107 ms
16,920 KB
testcase_43 AC 107 ms
16,920 KB
testcase_44 AC 108 ms
16,920 KB
testcase_45 AC 107 ms
16,920 KB
testcase_46 AC 110 ms
16,920 KB
testcase_47 AC 108 ms
16,920 KB
testcase_48 AC 91 ms
16,132 KB
testcase_49 AC 91 ms
16,132 KB
testcase_50 AC 91 ms
16,132 KB
testcase_51 AC 90 ms
16,132 KB
testcase_52 AC 91 ms
16,132 KB
testcase_53 AC 93 ms
16,132 KB
testcase_54 AC 92 ms
16,132 KB
testcase_55 AC 91 ms
16,132 KB
testcase_56 AC 90 ms
16,128 KB
testcase_57 AC 91 ms
16,132 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n, w = gets.chomp.split.map(&:to_i)
u, v = n.times.map{gets.chomp.split.map(&:to_i)}.transpose

d = Array.new(n+1).map{Array.new(w+1, 0)}
d[0][0] = 0

n.times do |i|
  (w+1).times do |j|
    if j - u[i] >= 0
      d[i+1][j] = [d[i][j], d[i][j-u[i]] + v[i]].max
    else
      d[i+1][j] = d[i][j]
    end
  end
end

puts w.times.map {|i| d[n][w] - d[n][w-i-1] + 1 }
0