結果
| 問題 | No.120 傾向と対策:門松列(その1) | 
| コンテスト | |
| ユーザー |  FromBooska | 
| 提出日時 | 2023-04-08 06:31:32 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 954 bytes | 
| コンパイル時間 | 567 ms | 
| コンパイル使用メモリ | 82,304 KB | 
| 実行使用メモリ | 78,080 KB | 
| 最終ジャッジ日時 | 2024-10-03 03:40:36 | 
| 合計ジャッジ時間 | 1,898 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | WA * 4 | 
ソースコード
# 同じ長さでない3本を選べばいい
# 長さごとに本数を数えて、本数降順として使うか
# それで間に合うか? N<100なので間に合うかも
T = int(input())
for t in range(T):
    N = int(input())
    L = list(map(int, input().split()))
    from collections import Counter
    counted = Counter(L)
    #print(counted)
    #print(type(counted))
    counted_list = []
    for n, c in counted.items():
        counted_list.append([n, c])
    counted_list.sort(key = lambda x:-x[1])
    #print(counted_list)
    count = 0
    while True:
        subcount = 0
        for i in range(len(counted_list)):
            if counted_list[i][1] > 0:
                subcount += 1
                counted_list[i][1] -= 1
            if subcount == 3:
                count += 1
                break
        #print('count', count, 'subcount', subcount, counted_list)
        if subcount < 3:
            break
    print(count)
            
            
            
        