Pagini recente » Cod sursa (job #862440) | Cod sursa (job #137984) | Cod sursa (job #2488147) | Cod sursa (job #2002354) | Cod sursa (job #1974743)
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.