結果
| 問題 |
No.120 傾向と対策:門松列(その1)
|
| コンテスト | |
| ユーザー |
horiesiniti
|
| 提出日時 | 2018-03-16 16:35:40 |
| 言語 | Ruby (3.4.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 259 bytes |
| コンパイル時間 | 51 ms |
| コンパイル使用メモリ | 7,424 KB |
| 実行使用メモリ | 13,952 KB |
| 最終ジャッジ日時 | 2024-12-21 14:29:46 |
| 合計ジャッジ時間 | 1,599 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 4 |
コンパイルメッセージ
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
e1=y[0]
y.shift
y[y.size-1]-=e1
y[y.size-2]-=e1
ans+=e1
y.sort!
end
puts ans
}
horiesiniti