結果

問題 No.50 おもちゃ箱
ユーザー letrangerjpletrangerjp
提出日時 2017-06-16 08:17:29
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 333 bytes
コンパイル時間 192 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 16,256 KB
最終ジャッジ日時 2024-04-08 13:16:33
合計ジャッジ時間 6,068 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 87 ms
16,256 KB
testcase_04 AC 88 ms
16,256 KB
testcase_05 AC 94 ms
16,256 KB
testcase_06 AC 89 ms
16,256 KB
testcase_07 AC 92 ms
16,256 KB
testcase_08 AC 90 ms
16,256 KB
testcase_09 AC 88 ms
16,256 KB
testcase_10 AC 88 ms
16,256 KB
testcase_11 WA -
testcase_12 AC 88 ms
16,256 KB
testcase_13 AC 87 ms
16,256 KB
testcase_14 AC 88 ms
16,256 KB
testcase_15 AC 88 ms
16,256 KB
testcase_16 AC 87 ms
16,256 KB
testcase_17 AC 88 ms
16,256 KB
testcase_18 AC 89 ms
16,256 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 88 ms
16,256 KB
testcase_22 AC 86 ms
16,256 KB
testcase_23 AC 88 ms
16,256 KB
testcase_24 AC 89 ms
16,256 KB
testcase_25 AC 88 ms
16,256 KB
testcase_26 AC 90 ms
16,256 KB
testcase_27 AC 88 ms
16,256 KB
testcase_28 AC 88 ms
16,256 KB
testcase_29 AC 88 ms
16,256 KB
testcase_30 AC 88 ms
16,256 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 88 ms
16,256 KB
testcase_34 AC 89 ms
16,256 KB
testcase_35 WA -
testcase_36 AC 92 ms
16,256 KB
testcase_37 AC 91 ms
16,256 KB
testcase_38 AC 89 ms
16,256 KB
testcase_39 AC 89 ms
16,256 KB
testcase_40 AC 87 ms
16,256 KB
testcase_41 AC 88 ms
16,256 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:21: warning: ambiguous first argument; put parentheses or a space even after `-' operator
Syntax OK

ソースコード

diff #

N = gets.to_i
A = gets.split.take(N).map(&:to_i)
M = gets.to_i
B = gets.split.take(M).map(&:to_i)

a = A.sort_by!{|v|-v}
b = B.sort_by!{|v|-v}
used = [false] * N

b.each_with_index{|box, i|
  a.each_with_index{|x, j|
    next if used[j] || box < x
    box -= x
    used[j] = true
  }
  if used.all?
    p i + 1
    exit
  end
}
p -1
0