結果

問題 No.120 傾向と対策:門松列(その1)
ユーザー yuki2006yuki2006
提出日時 2015-01-08 23:59:32
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 178 ms / 5,000 ms
コード長 574 bytes
コンパイル時間 1,188 ms
コンパイル使用メモリ 77,528 KB
実行使用メモリ 82,272 KB
最終ジャッジ日時 2023-09-03 22:45:34
合計ジャッジ時間 2,638 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 154 ms
81,892 KB
testcase_01 AC 164 ms
81,928 KB
testcase_02 AC 178 ms
82,272 KB
testcase_03 AC 164 ms
82,236 KB
権限があれば一括ダウンロードができます

ソースコード

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