Pagini recente » Cod sursa (job #993382) | Cod sursa (job #1031236) | Cod sursa (job #571501) | Cod sursa (job #2989443) | Cod sursa (job #2493470)
#include<bits/stdc++.h>
using namespace std;
const int nmax = 1000005;
ifstream fin("elmaj.in");
ofstream fout("elmaj.out");
int n;
map<int, int> v;
void rezolva()
{
int maxx = -1;
int nr, x;
cin >> n;
for(int i = 1; i <= n; i ++)
{
cin >> x;
v[x]++;
if(maxx < v[x])
{
maxx = v[x];
nr = x;
}
}
if((n /2) + 1 <= maxx)
cout << nr <<" " << maxx;
else
cout << -1;
}
int main()
{
rezolva();
return 0;
}