Pagini recente » Cod sursa (job #1819957) | Cod sursa (job #3289524) | Cod sursa (job #2460745) | Cod sursa (job #3254843) | 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;
}