結果

問題 No.120 傾向と対策:門松列(その1)
ユーザー gigurururugigurururu
提出日時 2015-01-08 23:38:54
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 209 bytes
コンパイル時間 57 ms
コンパイル使用メモリ 11,532 KB
実行使用メモリ 16,648 KB
最終ジャッジ日時 2023-09-03 22:43:01
合計ジャッジ時間 1,418 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:2: warning: assigned but unused variable - n
Syntax OK

ソースコード

diff #

gets.to_i.times{
  n=gets.to_i
  l=gets.split.map(&:to_i)
  a=[0,0]+l.group_by{|i|i}.values.map(&:size).sort
  cnt=0
  while a[-3]>0
    cnt+=a[-3]
    (1..3).each{|i|a[-i]-=a[-3]}
    a.sort!
  end
  p cnt
}
0