Pagini recente » Cod sursa (job #2229849) | Cod sursa (job #1944292) | Cod sursa (job #1179917) | Diferente pentru problema/pinex intre reviziile 26 si 34 | Cod sursa (job #2663439)
#include <bits/stdc++.h>
using namespace std;
ifstream f("elmaj.in");
ofstream g("elmaj.out");
int main()
{
int n;
unordered_map<int,int> M;
f>>n;
for(int i=1; i<=n; i++)
{
int x;
f>>x;
M[x]++;
}
for(unordered_map<int,int>::iterator i=M.begin(); i!=M.end(); i++)
if(i->second>n/2)
{
g<<i->first<<' '<<i->second;
return 0;
}
g<<-1;
return 0;
}