結果

問題 No.120 傾向と対策:門松列(その1)
ユーザー SSRS
提出日時 2020-09-16 15:36:36
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 411 bytes
コンパイル時間 1,009 ms
コンパイル使用メモリ 81,868 KB
最終ジャッジ日時 2025-01-14 15:14:06
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 4
権限があれば一括ダウンロードができます

ソースコード

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