Pagini recente » Istoria paginii runda/geometrie/clasament | Cod sursa (job #3253843) | Istoria paginii runda/oji200911 | Cod sursa (job #192922) | Cod sursa (job #1297669)
#include <fstream>
#include <vector>
using namespace std;
#define MOD 666013
long long n,loc,i,maxim,el,x;
vector <long> h[666015];
int main()
{
ifstream f("elmaj.in");
ofstream g("elmaj.out");
f>>n;
for (i=1;i<=n;++i) {
f>>x;
loc=x%MOD;
h[loc].push_back(1);
if (h[loc].size()>maxim) {maxim=h[loc].size();el=x;}
}
if (maxim>=n/2+1) g<<el<<' '<<maxim;
else
g<<"-1";
f.close();
g.close();
return 0;
}