結果
| 問題 | No.120 傾向と対策:門松列(その1) | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2015-01-08 23:51:13 | 
| 言語 | Python2 (2.7.18) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 828 bytes | 
| コンパイル時間 | 698 ms | 
| コンパイル使用メモリ | 7,040 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-06-13 03:20:18 | 
| 合計ジャッジ時間 | 997 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | WA * 4 | 
ソースコード
#!/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())
            
            
            
        