Pagini recente » Cod sursa (job #2657445) | Cod sursa (job #3286396) | Cod sursa (job #2955717) | Cod sursa (job #3232714) | Cod sursa (job #1061131)
#include <fstream>
#include <unordered_map>
using namespace std;
ifstream cin("elmaj.in");
ofstream cout("elmaj.out");
int n, i, x, a, b;
unordered_map<int, int> h;
unordered_map<int, int>::iterator it;
int main()
{
cin>>n;
for(i=1; i<=n; i++)
{
cin>>x;
h[x]++;
}
for(it=h.begin(); it!=h.end(); it++)
if(it->second>b)
{
a=it->first;
b=it->second;
}
cout<<a<<" "<<b;
return 0;
}