結果

問題 No.120 傾向と対策:門松列(その1)
コンテスト
ユーザー Hachimori
提出日時 2015-01-08 23:51:13
言語 PyPy2
(7.3.20)
結果
WA  
実行時間 -
コード長 828 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 133 ms
コンパイル使用メモリ 77,388 KB
最終ジャッジ日時 2025-12-03 13:28:11
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#!/usr/bin/env python


def read():
    return input(), map(int, raw_input().split())


def work((N, vList)):
    vList.sort()
    
    cntList = []

    idx = 0
    while idx < N:
        cnt = 1
        while idx + 1 < N and vList[idx] == vList[idx + 1]:
            idx += 1
            cnt += 1
        cntList.append(cnt)
        idx += 1
    
    ans = 0
    while len(cntList) >= 3:
        if cntList[0] == 0:
            del cntList[0]
            continue
        
        if cntList[1] == 0:
            del cntList[1]
            continue
        
        if cntList[2] == 0:
            del cntList[2]
            continue
        
        ans += 1
        cntList[0] -= 1
        cntList[1] -= 1
        cntList[2] -= 1

    print ans


if __name__ == "__main__":
    for i in range(input()):
        work(read())
0