結果
問題 | No.120 傾向と対策:門松列(その1) |
ユーザー |
![]() |
提出日時 | 2017-01-31 20:43:28 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 199 ms / 5,000 ms |
コード長 | 518 bytes |
コンパイル時間 | 95 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-12-24 01:05:15 |
合計ジャッジ時間 | 1,403 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 4 |
ソースコード
t = int(input()) for i in range(t): n = int(input()) L = list(map(int,input().split())) Lunique = list(set(L)) if len(Lunique)<=2: print(0) continue cnt = [L.count(lu) for lu in Lunique] cnt.sort(reverse=True) ans=0 while 1: for i in range(3): if cnt[i]==0: break cnt[i]-=1 else: cnt.sort(reverse=True) ans+=1 continue break print(ans)