求助!map 89分MLE
查看原帖
求助!map 89分MLE
1209037
ProgrammingCat楼主2024/8/7 16:49
#include<bits/stdc++.h>
using namespace std;
int n,t;
bool ans;
map<int,int> v;
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		scanf("%d",&t);
		v[t]++;
		if(v[t]>n/2&&ans==false){
			cout<<t;
			ans=true;
		}
	}
	return 0;
}

#3 MLE

2024/8/7 16:49
加载中...