Fish、のTorres 2011-08-21 12:21:00
点我顶贴
收藏
删除
var x,t,n,i,j:longint;
a,b:array[0..5000]of longint;
c:array[1..5000,1..5000]of longint;
begin
readln(n);
for i:=1 to n do begin
b[i]:=1;c[i,1]:=1;
read(a[i]);
for j:=1 to i-1 do begin
if a[i]<a[j] then begin
if b[j]+1>b[i] then b[i]:=b[j]+1;
inc(c[i,b[j]+1],c[j,b[j]]);
end;
end;
end;
for i:=1 to n do begin
if b[i]>x then x:=b[i];
end;
for i:=1 to n do t:=t+c[i,x];
//for i:=1 to n do writeln(b[i],' ',c[i]);
writeln(x,' ',t);
end.