m,f,z,c:array[1..5000] of longint;
n,i,best,j,alt,long:longint;
function find(a:longint):boolean;
var i:longint;
begin
for i:=1 to long do
if a=c[i] then begin exit(false); end;
inc(long); c[long]:=a; exit(true);
end;
begin
read(n);
for i:=1 to n do
read(m[i]);
filldword(f,sizeof(f) shr 2,1);
filldword(z,sizeof(z) shr 2,1);
for i:=n-1 downto 1 do
begin
fillchar(c,sizeof(c),0); long:=0;
for j:=i+1 to n do
begin
if m[j]=m[i] then break;
if (m[i]>m[j])and(f[j]+1>f[i]) then
begin
f[i]:=f[j]+1;
z[i]:=z[j];
fillchar(c,sizeof(c),0); long:=1;
c[1]:=m[j];
end
else if (m[i]>m[j]) and (f[j]=f[i]-1) and (find(m[j])) then z[i]:=z[i]+z[j];
end;
end;
best:=0;
for i:=1 to n do if f[i]>best then best:=f[i];
write(best,’ ’);
for i:=1 to n do if f[i]=best then alt:=alt+z[i];
writeln(alt);
end.
测评机: Xeost[5]
得分: 70分
提交日期: 2009-5-10 14:16:00
有效耗时: 844毫秒
测试结果1: 通过本测试点|有效耗时172ms
测试结果2: 通过本测试点|有效耗时62ms
测试结果3: 通过本测试点|有效耗时63ms
测试结果4: 通过本测试点|有效耗时62ms
测试结果5: 通过本测试点|有效耗时47ms
测试结果6: 测试结果错误.错误结果为:36 12
正确结果应为:36 16
测试结果7: 测试结果错误.错误结果为:20 4
正确结果应为:20 1
测试结果8: 测试结果错误.错误结果为:59 266112
正确结果应为:59 532224
测试结果9: 通过本测试点|有效耗时188ms
测试结果10: 通过本测试点|有效耗时250ms
