Pagini recente » Cod sursa (job #803431) | Profil UPB_Bobulisteanu_Bobulisteanu_Nitu | Cod sursa (job #2057242) | Cod sursa (job #2963617) | Cod sursa (job #2340246)
#include <fstream>
#include <map>
using namespace std;
ifstream fin("elmaj.in");
ofstream fout("elmaj.out");
map <int, int> fr;
int main()
{
int n;
fin >> n;
for(int i = 1; i <= n; ++i){
int x;
fin >> x;
if(fr.find(x) == fr.end())
fr[x] = 1;
else fr[x]++;
}
for(auto it : fr){
if(it.second > n / 2){
fout << it.first << ' ' << it.second << '\n';
return 0;
}
}
fout << -1 << '\n';
return 0;
}