Cod sursa(job #221789)

Utilizator andreivFMI - vacaroiu andrei andreiv Data 17 noiembrie 2008 22:48:13
Problema Subsir crescator maximal Scor 10
Compilator fpc Status done
Runda Arhiva educationala Marime 0.59 kb
program scm;
var ok:array[1..150] of byte;
    v:array[1..10001] of longint;
    n,i,st,stp,max,pl,op:longint;
    f,g:text;
begin
assign(f,'scmax.in');
assign(g,'scmax.out');
reset(f);
rewrite(g);
read(f,n);readln(f);read(f,v[1]);st:=1;stp:=0;max:=0;
for i:=2 to n do
begin
read(f,v[i]);
if v[i]>v[i-1] then
stp:=i else begin st:=i; if stp-st+1>max then begin max:=stp-st+1; pl:=st;op:=stp; end; end;
end;
if stp-st+1>max then begin max:=stp-st+1; pl:=st;op:=stp; end;
write(g,max);writeln(g);
for i:=pl to op-1 do write(g,v[i],' ');
write(g,v[op]);
closE(f);
close(g);
end.