3 a
,f
:array [0..1000] of longint;
7 for i
:=1 to n
do begin read(a
[i
]); f
[i
]:=1; end;
10 for j
:=i
-1 downto 1 do
13 if f
[i
]<f
[j
]+1 then f
[i
]:=f
[j
]+1;
14 if f
[i
]>max
then max
:=f
[i
];
17 for i
:=1 to n
do f
[i
]:=1; max
:=1;
19 for j
:=i
-1 downto 1 do
22 if f
[i
]<f
[j
]+1 then f
[i
]:=f
[j
]+1;
23 if f
[i
]>max
then max
:=f
[i
];