結果

問題 No.120 傾向と対策:門松列(その1)
ユーザー 👑 horiesinitihoriesiniti
提出日時 2018-03-16 16:35:40
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 259 bytes
コンパイル時間 70 ms
コンパイル使用メモリ 11,480 KB
実行使用メモリ 17,408 KB
最終ジャッジ日時 2023-08-23 11:49:53
合計ジャッジ時間 1,707 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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
	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
		e1=y[0]
		y.shift
		y[y.size-1]-=e1
		y[y.size-2]-=e1
		ans+=e1
		y.sort!
	end
	puts ans
}
0