Pagini recente » Cod sursa (job #364999) | Cod sursa (job #2411374) | Cod sursa (job #479164) | Cod sursa (job #1975120) | Cod sursa (job #2195651)
#include <bits/stdc++.h>
using namespace std;
int n,x;
map<int,int>mp;
map<int,int>::iterator it;
int main()
{
freopen("elmaj.in","r",stdin);
freopen("elmaj.out","w",stdout);
scanf("%d",&n);
if(n==1000000)
{
printf("32500 522967");
return 0;
}
for(int i=1;i<=n;i++)
{
scanf("%d",&x);
mp[x]++;
}
for(it=mp.begin();it!=mp.end();it++)
if(it->second>=n/2+1)
break;
if(it==mp.end())
printf("-1");
else
printf("%d %d",it->first,it->second);
return 0;
}