Cod sursa(job #316689)

Utilizator andrey932Andrei andrey932 Data 20 mai 2009 19:35:12
Problema Subsir crescator maximal Scor 35
Compilator fpc Status done
Runda Arhiva educationala Marime 0.51 kb
uses math;
var x,ad,ad1,nr:array[0..100000] of longint;
    i,j,a,b,n:longint;
    t:text;
begin
assign(t,'scmax.in'); reset(t);
readln(t,n);
for i:=1 to n do
  begin
    read(t,nr[i]);
    x[i]:=1;
    for j:=1 to i-1 do
      begin
       if (nr[j]<nr[i]) then
        if (x[j]+1>x[i]) then
          begin
            x[i]:=x[j]+1;
          end;
      end;
  end;
close(t);
assign(t,'scmax.out'); rewrite(t);
j:=1;
for i:=1 to n do
  if x[i]>j then j:=x[i];
writeln(t,j);
close(t);
end.