Run ID:88171
提交时间:2024-08-18 11:18:35
#include<bits/stdc++.h> using namespace std; int k; int main(){ cin >> k; while(k--) { int n; cin >> n; int t[10001] = {}; int sg; for(int i = 0;i <= n-1; i++){ cin >> sg; t[sg]++; } int mx = -2e9; for(int i = 1; i<=10000; i++) { if(t[i] > mx) { mx = t[i]; } } if(n % 2 == 0) { if(mx <= n/2) { cout << "Y" << endl; } else { cout << "N" << endl; } } else { if(mx <= n/2+1) { cout << "Y" << endl; } else { cout << "N" << endl; } } } return 0; }