結果
| 問題 | No.120 傾向と対策:門松列(その1) |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-03-05 18:26:24 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 139 ms / 5,000 ms |
| コード長 | 522 bytes |
| 記録 | |
| コンパイル時間 | 307 ms |
| コンパイル使用メモリ | 82,304 KB |
| 実行使用メモリ | 77,568 KB |
| 最終ジャッジ日時 | 2024-10-06 19:59:52 |
| 合計ジャッジ時間 | 1,680 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 4 |
ソースコード
T = int(input())
for case in range(T):
N = int(input())
L = list(map(int, input().split()))
rem = []
app = set()
for i in range(N):
if L[i] not in app:
app.add(L[i])
rem.append(L.count(L[i]))
rem.sort(reverse = True)
if len(rem) < 3:
print(0)
continue
ans = 0
while True:
if rem[2] <= 0:
break
ans += 1
rem[0] -= 1
rem[1] -= 1
rem[2] -= 1
rem.sort(reverse = True)
print(ans)