Cod sursa(job #315456)
| Utilizator | Data | 15 mai 2009 17:59:45 | |
|---|---|---|---|
| Problema | Subsir 2 | Scor | 0 |
| Compilator | fpc | Status | done |
| Runda | Arhiva de probleme | Marime | 0.5 kb |
uses math;
var x,s:array[0..5001] of longint;
n,i,j,a,b,l:longint;
t:text;
begin
assign(t,'subsir2.in'); reset(t);
readln(t,n);
for i:=1 to n do
readln(t,x[i]);
s[0]:=0;
x[0]:=0;
s[1]:=1;
for i:=1 to n do
begin
s[i]:=1;
for j:=1 to i-1 do
begin
if ((x[j]<=x[i]) and (s[i]<s[j]+1)) then
begin
s[i]:=s[j]+1;
end
end;
end;
close(t);
assign(t,'subsir2.out'); rewrite(t); writeln(t,maxvalue(s));
close(t);
end.