Pagini recente » Cod sursa (job #489350) | Cod sursa (job #1289321) | Cod sursa (job #1690135) | Cod sursa (job #2071341) | Cod sursa (job #1974741)
var f,g:text;
a,nr:array[1..2000000]of int64;
n,i,max:longint;
k:int64;
begin
assign(f,'elmaj.in');
assign(g,'elmaj.out');
reset(f);
rewrite(g);
read(f,n);
for i:=1 to n do
begin
read(f,a[i]);
nr[a[i]]:=nr[a[i]]+1;
end;
max:=0;
for i:=1 to n do
if max<nr[a[i]] then begin
max:=nr[a[i]];
k:=a[i];
end;
if max>n div 2+1 then write(g,k,' ',max)
else write(g,'-1');
close(f);
close(g);
end.