Pagini recente » Rating Nociv Hasis (ivanhoe) | Cod sursa (job #807584) | Cod sursa (job #362476) | Cod sursa (job #1030745) | Cod sursa (job #1064879)
#include <iostream>
#include <stdio.h>
#include <unordered_map>
using namespace std;
int n;
std::unordered_map<int,int> mymap;
int main ()
{
freopen("elmaj.in","r",stdin);
freopen("elmaj.out","w",stdout);
scanf("%d",&n);
int nr;
bool stop = false;
for(int i = 0; i < n; i++)
scanf("%d",&nr),mymap[nr]++;
for(unordered_map<int,int>::iterator it=mymap.begin();it!=mymap.end();it++)
if(it->second > (n >> 1)){
printf("%d %d",it->first,it->second),stop = true;
break;
}
if(stop == false)
printf("-1");
return 0;
}