Pagini recente » Cod sursa (job #1348295) | Cod sursa (job #1463987) | Cod sursa (job #1499989) | Cod sursa (job #1240412) | Cod sursa (job #2956411)
#include <iostream>
#include <fstream>
#include <map>
using namespace std;
ifstream fin("elmaj.in");
ofstream fout("elmaj.out");
map<int,int>m;
int main()
{
int n;
fin>>n;
for(int i=1 ; i<=n ; i++)
{
int x;
fin>>x;
m[x]++;
}
int ok=0;
for(auto i:m)
{
if(i.second>=n/2+1)
{
fout<<i.first<<" "<<i.second;
ok=1;
break;
}
}
if(ok==0)
fout<<-1;
return 0;
}