Pagini recente » Cod sursa (job #2167056) | Cod sursa (job #2233969) | Cod sursa (job #1420749) | Cod sursa (job #155746) | Cod sursa (job #2740944)
#include <bits/stdc++.h>
using namespace std;
ifstream fin("elmaj.in");
ofstream fout("elmaj.out");
int n;
unordered_map<int, int> m;
int main()
{
int i, x;
fin >> n;
for(i=1; i<=n; i++)
{
fin >> x;
m[x]++;
}
bool gasit=false;
for(auto p : m)
if(p.second>=n/2+1)
{
fout << p.first << ' ' << p.second;
gasit=true;
break;
}
if(!gasit)
fout << -1;
return 0;
}