結果

問題 No.120 傾向と対策:門松列(その1)
ユーザー TawaraTawara
提出日時 2015-10-13 18:07:37
言語 Python2
(2.7.18)
結果
AC  
実行時間 158 ms / 5,000 ms
コード長 257 bytes
コンパイル時間 60 ms
コンパイル使用メモリ 6,528 KB
実行使用メモリ 6,660 KB
最終ジャッジ日時 2023-09-28 12:55:38
合計ジャッジ時間 1,284 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 137 ms
6,660 KB
testcase_01 AC 156 ms
6,556 KB
testcase_02 AC 83 ms
6,608 KB
testcase_03 AC 158 ms
6,656 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter
T = input()
for i in xrange(T):
	N = input()
	l = Counter(map(int,raw_input().split())).values()
	ans = 0
	if len(l) >= 3:
		l.sort()
		while l[-3] > 0:
			ans += 1
			l[-1] -= 1; l[-2] -= 1; l[-3] -= 1
			l.sort()
	print ans
0