結果

問題 No.120 傾向と対策:門松列(その1)
ユーザー yuki2006
提出日時 2015-01-08 23:59:32
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 172 ms / 5,000 ms
コード長 574 bytes
コンパイル時間 2,779 ms
コンパイル使用メモリ 76,704 KB
実行使用メモリ 81,072 KB
最終ジャッジ日時 2024-06-13 03:23:24
合計ジャッジ時間 4,040 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

# -*- coding: utf-8 -*-
from collections import Counter

T = int(raw_input())

for i in xrange(T):
    N = int(raw_input())
    L = map(int, raw_input().split())

    counter = Counter()
    for l in L:
        counter[l] += 1

    M = []
    for cnt in counter:
        M.append(counter[cnt])

    count = 0
    while 1:
        M.sort(reverse=True)
        if len(M)<3:
            break
        if M[0] > 0 and M[1] > 0 and M[2] > 0:
            M[0] -= 1
            M[1] -= 1
            M[2] -= 1
            count += 1
        else:
            break
    print count
0