結果
| 問題 | No.120 傾向と対策:門松列(その1) | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2015-06-11 23:14:19 | 
| 言語 | Python2 (2.7.18) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 120 ms / 5,000 ms | 
| コード長 | 454 bytes | 
| コンパイル時間 | 39 ms | 
| コンパイル使用メモリ | 7,040 KB | 
| 実行使用メモリ | 6,912 KB | 
| 最終ジャッジ日時 | 2024-07-06 15:47:01 | 
| 合計ジャッジ時間 | 940 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 4 | 
ソースコード
# -*- coding:utf-8 -*- import collections def solve(): n = input() L = map(int,raw_input().split()) cnt = collections.Counter(L) if len(set(L)) < 3: print 0 return no1 = cnt.most_common(1)[0][1] no2 = cnt.most_common(2)[1][1] if no1 <= n /3.0: print n / 3 return else: if no2 > (n - no1)/2: print n - no1 - no2 return else: print (n-no1) / 2 return if __name__ == "__main__": t = input() for i in xrange(t): solve()
