結果

問題 No.2492 Knapsack Problem?
ユーザー Merry-AmorMerry-Amor
提出日時 2023-10-14 19:59:57
言語 Ruby
(3.3.0)
結果
AC  
実行時間 83 ms / 2,000 ms
コード長 323 bytes
コンパイル時間 387 ms
コンパイル使用メモリ 11,416 KB
実行使用メモリ 15,264 KB
最終ジャッジ日時 2023-10-14 20:00:10
合計ジャッジ時間 2,991 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
15,224 KB
testcase_01 AC 74 ms
15,180 KB
testcase_02 AC 75 ms
15,040 KB
testcase_03 AC 76 ms
15,096 KB
testcase_04 AC 78 ms
15,132 KB
testcase_05 AC 74 ms
15,100 KB
testcase_06 AC 76 ms
15,180 KB
testcase_07 AC 83 ms
15,116 KB
testcase_08 AC 74 ms
15,176 KB
testcase_09 AC 76 ms
15,264 KB
testcase_10 AC 74 ms
15,144 KB
testcase_11 AC 74 ms
15,180 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:3: warning: assigned but unused variable - i
Syntax OK

ソースコード

diff #

input_line = gets.chomp!.split(' ').map{|n| n.to_i}
v_line = []
for i in 1..input_line[0]
        input_line2 = gets.chomp!.split(' ').map{|n| n.to_i}
        if input_line2[1] <= input_line[1] then
                v_line.push(input_line2[0])
        end
end
if v_line == [] then
        v_line.push(-1)
end
puts v_line.max
0