Pagini recente » Cod sursa (job #755865) | Cod sursa (job #1713589) | Cod sursa (job #2720063) | Cod sursa (job #141767) | Cod sursa (job #1101343)
program p1;
var a,b,sol:array[0..100000] of longint;
f,g:text;
i,n,j,k,u,aux,max:longint;
procedure Sort(l, r: longint);
var
i, j, x, y: longint;
begin
i := l; j := r; x := a[(l+r) DIV 2];
repeat
while a[i] < x do i := i + 1;
while x < a[j] do j := j - 1;
if i <= j then
begin
y := a[i]; a[i] := a[j]; a[j] := y; aux:=b[i]; b[i]:=b[j]; b[j]:=aux;
i := i + 1; j := j - 1;
end;
until i > j;
if l < j then Sort(l, j);
if i < r then Sort(i, r);
end;
begin
assign(f,'scmax.in');reset(F);
assign(g,'scmax.out');rewrite(G);
readln(f,n);
for i:=1 to n do begin
read(f,a[i]);
b[i]:=i;
end;
sort(1,n);
max:=-99999;
for i:=1 to n do
IF B[I]>MAX THEN BEGIN
INC(u);
SOL[U]:=a[i];
max:=b[i];
end;
writeln(G,u);
for i:=1 to u do write(g,sol[i],' ');
close(F);
close(G);
end.