Run ID:7271

提交时间:2025-04-12 11:24:44

#include<bits/stdc++.h> using namespace std; int a[10001],k,n,_max; int main(){ cin>>k; while(k--){ cin>>n; for(int i=1;i<=n;i++){ int temp; cin>>temp; a[temp]++; _max=max(_max,a[temp]); } if(n%2==0){ if(_max<=n/2) cout<<"Y"<<endl; else cout<<"N"<<endl; } else{ if(_max<=(n/2+1)) cout<<"Y"<<endl; else cout<<"N"<<endl; } _max=0; memset(a,0,sizeof(a)); } return 0; }