結果

問題 No.156 キャンディー・ボックス
ユーザー quilt-tailsquilt-tails
提出日時 2016-10-27 18:19:28
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 301 bytes
コンパイル時間 52 ms
コンパイル使用メモリ 11,544 KB
実行使用メモリ 15,336 KB
最終ジャッジ日時 2023-08-15 20:22:19
合計ジャッジ時間 10,946 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 95 ms
15,036 KB
testcase_01 AC 82 ms
15,172 KB
testcase_02 AC 83 ms
15,148 KB
testcase_03 AC 84 ms
15,172 KB
testcase_04 AC 84 ms
15,040 KB
testcase_05 AC 143 ms
15,172 KB
testcase_06 AC 217 ms
15,152 KB
testcase_07 AC 186 ms
15,196 KB
testcase_08 AC 166 ms
15,204 KB
testcase_09 AC 142 ms
15,076 KB
testcase_10 AC 184 ms
15,096 KB
testcase_11 AC 138 ms
15,252 KB
testcase_12 AC 214 ms
15,280 KB
testcase_13 AC 170 ms
15,104 KB
testcase_14 AC 139 ms
15,288 KB
testcase_15 AC 181 ms
15,048 KB
testcase_16 AC 144 ms
15,196 KB
testcase_17 AC 170 ms
15,124 KB
testcase_18 AC 114 ms
15,104 KB
testcase_19 AC 117 ms
15,232 KB
testcase_20 AC 85 ms
15,248 KB
testcase_21 AC 91 ms
15,204 KB
testcase_22 AC 111 ms
14,992 KB
testcase_23 AC 97 ms
15,172 KB
testcase_24 AC 83 ms
15,152 KB
testcase_25 AC 83 ms
15,292 KB
testcase_26 AC 84 ms
15,148 KB
testcase_27 AC 84 ms
15,204 KB
testcase_28 AC 85 ms
15,212 KB
testcase_29 AC 85 ms
15,168 KB
testcase_30 AC 432 ms
15,092 KB
testcase_31 AC 211 ms
15,256 KB
testcase_32 TLE -
testcase_33 TLE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:1: warning: assigned but unused variable - n
Syntax OK

ソースコード

diff #

n, m = gets.split.map(&:to_i)
box = gets.split.map(&:to_i)
count = 0
empty_box = 0
while m > count
  if box.min > 0
    box[box.index(box.min)] -= 1
    count += 1
    if box.min == 0
      box.delete_at(box.index(box.min))
      empty_box += 1
    end
    break if count == m
  end
end
puts empty_box
0