Pagini recente » Rating buzduganii valcea (Buzduganii) | Rating Huhurez Marius (alevasluiale) | Rating Pislaru Vlad Rares (VladPislaru) | Profil UCV_Simion_Serban_Tolgoi | Cod sursa (job #2340262)
#include<bits/stdc++.h>
using namespace std;
ifstream fin("elmaj.in");
ofstream fout("elmaj.out");
int v[1000000];
int main()
{
int n,i,lpos=0;
fin>>n;
for(i=0;i<n;i++)
{
fin>>v[i];
}
sort(v,v+n);
for(i=1;i<n;i++)
{
if(v[i]!=v[i-1])
{
if(i-lpos>n/2)
{
fout<<v[i-1]<<" "<<i-lpos;
return 0;
}
lpos=i;
}
}
if(i-lpos>n/2)
{
fout<<v[i-1]<<" "<<i-lpos;
return 0;
}
fout<<-1;
return 0;
}