結果
問題 |
No.2492 Knapsack Problem?
|
ユーザー |
|
提出日時 | 2023-10-14 19:52:04 |
言語 | Ruby (3.4.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 315 bytes |
コンパイル時間 | 542 ms |
コンパイル使用メモリ | 7,296 KB |
実行使用メモリ | 12,288 KB |
最終ジャッジ日時 | 2024-09-16 13:45:57 |
合計ジャッジ時間 | 3,242 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 8 WA * 1 |
コンパイルメッセージ
Main.rb:10: warning: ambiguous first argument; put parentheses or a space even after `-' operator Main.rb:3: warning: assigned but unused variable - i Syntax OK
ソースコード
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 puts -1 end puts v_line.max