Pagini recente » Profil Mihai780 | Profil Roswen | Cod sursa (job #1388331) | Statistici georgescu cosmin (onisim) | Cod sursa (job #1298051)
#include<fstream>
#include<map>
using namespace std;
ifstream cin("elmaj.in");
ofstream cout("elmaj.out");
map<int,int> H;
map<int,int>::iterator it;
int N,X,aux;
int main(){
cin>>N;
for(int i=0;i<N;i++){
cin>>X;
it=H.find(X);
if(it==H.end())
H[X]=1;
else{
aux=it->second;
H.erase(it);
H[X]=aux+1;
}
}//end for
for(it=H.begin();it!=H.end();it++)
if(it->second>(int)N/2)
break;
cout<<it->first<<" "<<it->second;
return 0;
}