結果

問題 No.120 傾向と対策:門松列(その1)
ユーザー trineutron
提出日時 2021-02-23 13:38:18
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 94 ms / 5,000 ms
コード長 321 bytes
コンパイル時間 133 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-09-22 08:58:59
合計ジャッジ時間 930 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict

def solve():
    n = int(input())
    l = list(map(int, input().split()))
    d = defaultdict(int)
    for x in l:
        d[x] += 1
    v = list(d.values())
    v.sort(reverse=True)
    print(min(n // 3, sum(v[1:]) // 2, sum(v[2:])))

t = int(input())
for i in range(t):
    solve()
0