Pagini recente » Cod sursa (job #931764) | Cod sursa (job #1823580) | Cod sursa (job #641046) | Cod sursa (job #1094161) | Cod sursa (job #1652428)
var a:array [1..1000002] of real;
n:longint; q:real;
procedure lire;
var i:longint;
begin
assign(input,'elmaj.in');
reset(input);
read(n);
for i:=1 to n do
read(a[i]);
close(input);
end;
procedure sw(var x,y:real);
var q:real;
begin
q:=x;
x:=y;
y:=q;
end;
procedure qs(l,r:longint);
var i,j:longint; q:real;
begin
i:=l; j:=r; q:=a[(i+j) div 2];
while (i<j) do
begin
while (a[i]<q) do i:=i+1;
while (a[j]>q) do j:=j-1;
if (i<=j) then
begin
sw(a[i],a[j]);
i:=i+1;
j:=j-1;
end;
end;
if (i<r) then qs(i,r);
if (j>l) then qs(l,j);
end;
function lu:longint;
var i,x:longint;
begin
x:=1; q:=a[1];
for i:=2 to n do
if a[i]=q then x:=x+1 else begin x:=1; q:=a[i]; end;
lu:=x;
end;
procedure ecrire(x:longint);
begin
assign(output,'elmaj.out');
rewrite(output);
if x>(n div 2) then write(x,' ',q) else write(-1);
close(output);
end;
begin
lire;
qs(1,n);
ecrire(lu);
end.