結果

問題 No.120 傾向と対策:門松列(その1)
ユーザー SSRSSSRS
提出日時 2020-09-16 15:36:36
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 411 bytes
コンパイル時間 1,417 ms
コンパイル使用メモリ 86,452 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-04 03:35:36
合計ジャッジ時間 2,236 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <vector>
#include <map>
using namespace std;
int main(){
	int T;
	cin >> T;
	for (int i = 0; i < T; i++){
		int N;
		cin >> N;
		vector<int> L(N);
		for (int j = 0; j < N; j++){
			cin >> L[j];
		}
		map<int, int> mp;
		for (int j = 0; j < N; j++){
			mp[L[j]]++;
		}
		int mx = 0;
		for (auto P : mp){
			mx = max(mx, P.second);
		}
		cout << min(N / 3, (N - mx) / 2) << endl;
	}
}
0