結果
問題 | No.120 傾向と対策:門松列(その1) |
ユーザー | 👑 horiesiniti |
提出日時 | 2018-03-16 16:49:23 |
言語 | Ruby (3.3.0) |
結果 |
AC
|
実行時間 | 283 ms / 5,000 ms |
コード長 | 278 bytes |
コンパイル時間 | 58 ms |
コンパイル使用メモリ | 11,228 KB |
実行使用メモリ | 19,920 KB |
最終ジャッジ日時 | 2023-08-23 11:50:07 |
合計ジャッジ時間 | 1,802 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 221 ms
18,184 KB |
testcase_01 | AC | 283 ms
19,764 KB |
testcase_02 | AC | 160 ms
18,160 KB |
testcase_03 | AC | 283 ms
19,920 KB |
コンパイルメッセージ
Main.rb:2: warning: assigned but unused variable - n Syntax OK
ソースコード
gets.to_i.times{ n=gets.to_i x=gets.split.map{|e| e.to_i}.sort hs=Hash.new(0) while x.size>0 hs[x[0]]+=1 x.shift end y=hs.values.sort ans=0 while y.size>2 y[y.size-1]-=1 y[y.size-2]-=1 y[y.size-3]-=1 y=y.sort.select{|e4| e4>0 } ans+=1 end puts ans }