結果

問題 No.1285 ゴミ捨て
ユーザー simansiman
提出日時 2020-11-29 21:14:46
言語 Ruby
(3.3.0)
結果
AC  
実行時間 235 ms / 2,000 ms
コード長 236 bytes
コンパイル時間 385 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 14,592 KB
最終ジャッジ日時 2024-05-06 14:42:08
合計ジャッジ時間 5,050 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 95 ms
12,160 KB
testcase_01 AC 97 ms
12,160 KB
testcase_02 AC 93 ms
12,288 KB
testcase_03 AC 93 ms
12,416 KB
testcase_04 AC 92 ms
12,160 KB
testcase_05 AC 94 ms
12,416 KB
testcase_06 AC 91 ms
12,160 KB
testcase_07 AC 231 ms
14,464 KB
testcase_08 AC 100 ms
12,288 KB
testcase_09 AC 151 ms
13,056 KB
testcase_10 AC 204 ms
14,208 KB
testcase_11 AC 197 ms
14,080 KB
testcase_12 AC 175 ms
13,568 KB
testcase_13 AC 173 ms
13,440 KB
testcase_14 AC 217 ms
14,592 KB
testcase_15 AC 184 ms
13,824 KB
testcase_16 AC 124 ms
12,672 KB
testcase_17 AC 128 ms
12,800 KB
testcase_18 AC 127 ms
12,544 KB
testcase_19 AC 150 ms
13,056 KB
testcase_20 AC 124 ms
12,800 KB
testcase_21 AC 132 ms
12,800 KB
testcase_22 AC 235 ms
14,464 KB
testcase_23 AC 229 ms
14,592 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