Pagini recente » Cod sursa (job #178705) | Cod sursa (job #1346237) | Cod sursa (job #873898) | Cod sursa (job #723618) | Cod sursa (job #1608313)
#include <cstdio>
#include <map>
using namespace std;
map<long long,int> x;
int n,aux,i;
int main()
{
freopen("elmaj.in","r",stdin);
freopen("elmaj.out","w",stdout);
scanf("%d\n",&n);
for(i=1;i<=n;i++){
scanf("%d",&aux);
x[aux]++;
}
for(map<long long,int>::iterator it=x.begin();it!=x.end();++it)
if(it->second>=n/2+1){
printf("%d ",it->first);
printf("%d ",it->second);
return 0;
}
printf("-1");
return 0;
}