結果

問題 No.120 傾向と対策:門松列(その1)
ユーザー 25__toma25__toma
提出日時 2019-01-02 00:21:52
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 175 ms / 5,000 ms
コード長 650 bytes
コンパイル時間 89 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-04-26 15:33:38
合計ジャッジ時間 1,245 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
10,752 KB
testcase_01 AC 174 ms
10,752 KB
testcase_02 AC 89 ms
10,624 KB
testcase_03 AC 175 ms
10,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

T = int(input())
#s = [[int(j) for j in input().split()] for i in range(N)]

for i in range(T):
    N = int(input())
    L = [int(i) for i in input().split()]
    amount = sorted([L.count(num) for num in set(L)])
    if len(amount)<3:
        print(0)
        continue
    low = sum(amount[:-2])
    mid = amount[-2]
    high = amount[-1]
    if low<=mid:
        #print("mid")
        print(low)
    else:
        #print("now: low.",low," mid.",mid," high",high)
        low -= mid
        high -= mid
        if low <= high*2:
            #print("high")
            print(mid+low//2)
        else:
            #print("low")
            print(N//3)
0