結果

問題 No.1285 ゴミ捨て
ユーザー simansiman
提出日時 2020-11-29 21:14:46
言語 Ruby
(3.3.0)
結果
AC  
実行時間 212 ms / 2,000 ms
コード長 236 bytes
コンパイル時間 368 ms
コンパイル使用メモリ 11,196 KB
実行使用メモリ 17,920 KB
最終ジャッジ日時 2023-08-19 07:27:14
合計ジャッジ時間 4,766 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
15,308 KB
testcase_01 AC 81 ms
15,180 KB
testcase_02 AC 89 ms
15,100 KB
testcase_03 AC 82 ms
15,320 KB
testcase_04 AC 82 ms
15,128 KB
testcase_05 AC 82 ms
15,100 KB
testcase_06 AC 82 ms
15,104 KB
testcase_07 AC 206 ms
17,632 KB
testcase_08 AC 88 ms
15,264 KB
testcase_09 AC 134 ms
16,288 KB
testcase_10 AC 189 ms
17,128 KB
testcase_11 AC 178 ms
17,104 KB
testcase_12 AC 152 ms
16,756 KB
testcase_13 AC 153 ms
16,584 KB
testcase_14 AC 200 ms
17,348 KB
testcase_15 AC 166 ms
17,072 KB
testcase_16 AC 104 ms
15,472 KB
testcase_17 AC 106 ms
15,584 KB
testcase_18 AC 103 ms
15,536 KB
testcase_19 AC 129 ms
16,148 KB
testcase_20 AC 103 ms
15,592 KB
testcase_21 AC 115 ms
15,836 KB
testcase_22 AC 212 ms
17,820 KB
testcase_23 AC 210 ms
17,920 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N = gets.to_i
A = N.times.map { gets.to_i }.sort
C = Array.new(N, -Float::INFINITY)

A.each do |a|
  N.times do |i|
    c = C[i]

    if c + 1 < a
      C[i] = a
      break
    end
  end
end

puts C.count { |c| c != -Float::INFINITY }
0