結果

問題 No.120 傾向と対策:門松列(その1)
ユーザー trineutrontrineutron
提出日時 2021-02-23 13:38:18
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 92 ms / 5,000 ms
コード長 321 bytes
コンパイル時間 97 ms
コンパイル使用メモリ 11,980 KB
実行使用メモリ 10,160 KB
最終ジャッジ日時 2023-10-22 07:55:32
合計ジャッジ時間 972 ms
ジャッジサーバーID
(参考情報)
judge9 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
10,152 KB
testcase_01 AC 92 ms
10,156 KB
testcase_02 AC 62 ms
10,160 KB
testcase_03 AC 86 ms
10,152 KB
権限があれば一括ダウンロードができます

ソースコード

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