結果
| 問題 |
No.120 傾向と対策:門松列(その1)
|
| コンテスト | |
| ユーザー |
kutsutama
|
| 提出日時 | 2019-01-14 03:44:46 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 152 ms / 5,000 ms |
| コード長 | 625 bytes |
| コンパイル時間 | 235 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 10,880 KB |
| 最終ジャッジ日時 | 2024-12-30 02:18:49 |
| 合計ジャッジ時間 | 1,792 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 4 |
ソースコード
import collections
def solve(N, L):
c = collections.Counter()
for Li in L:
c[Li] += 1
cnt = list(c.values())
if len(cnt) < 3:
return 0
res = 0
while True:
cnt.sort(reverse=True)
if cnt[0] > 0 and cnt[1] > 0 and cnt[2] > 0:
res += 1
cnt[0] -= 1
cnt[1] -= 1
cnt[2] -= 1
else:
break
return res
T = int(input())
lis = [0] * T
for tt in range(T):
nt = int(input())
lt = [int(x) for x in input().split()]
lis[tt] = solve(nt, lt)
print(*lis, sep='\n')
kutsutama