結果
| 問題 | No.120 傾向と対策:門松列(その1) | 
| コンテスト | |
| ユーザー |  はむ吉🐹 | 
| 提出日時 | 2016-04-04 19:20:41 | 
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 399 ms / 5,000 ms | 
| コード長 | 663 bytes | 
| コンパイル時間 | 139 ms | 
| コンパイル使用メモリ | 12,672 KB | 
| 実行使用メモリ | 11,008 KB | 
| 最終ジャッジ日時 | 2024-10-04 00:50:25 | 
| 合計ジャッジ時間 | 2,349 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 4 | 
ソースコード
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import array
import collections
def compute_maximum(bamboos):
    answer = 0
    counter = collections.Counter(bamboos)
    if len(counter) < 3:
        return answer
    while True:
        cands = counter.most_common(3)
        if cands[-1][1] <= 0:
            return answer
        used = {x: 1 for x in [cand[0] for cand in cands]}
        counter.subtract(used)
        answer += 1
def main():
    t = int(input())
    for _ in range(t):
        _ = int(input())
        bamboos = array.array("L", map(int, input().split()))
        print(compute_maximum(bamboos))
if __name__ == '__main__':
    main()
            
            
            
        