結果

問題 No.120 傾向と対策:門松列(その1)
ユーザー ktshunktshun
提出日時 2015-06-11 23:10:27
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 469 bytes
コンパイル時間 40 ms
コンパイル使用メモリ 6,672 KB
実行使用メモリ 6,804 KB
最終ジャッジ日時 2023-09-20 20:59:12
合計ジャッジ時間 1,143 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

# -*- coding:utf-8 -*-
import collections

def solve():
	n = input()
	L = map(int,raw_input().split())
	cnt = collections.Counter(L)
	if len(set(L)) < 3:
		print 0
		return
	no1 = cnt.most_common(1)[0][1]
	no2 = cnt.most_common(2)[1][1]
	print no1,no2
	if no1 <= n /3.0:
		print n / 3
		return
	else:
		if no2 > (n - no1)/2:
			print n - no1 - no2
			return
		else:
			print (n-no1) / 2
			return

if __name__ == "__main__":
	t = input()
	for i in xrange(t):
		solve()
0