讨论 / 来看看、、、、、、、。。。。。。-_-~`~!
liguohao1994 2009-05-15 08:21:00
点我顶贴 收藏 删除
const

maxn=5000;

maxlen=1000;

maxh=20000;

type

hp=record

len:integer;

s:array[1..maxlen] of byte;

end;

var

q,f:array[0..maxn] of longint;

count:array[0..maxn] of hp;

n:integer;

procedure init;

var

i:integer;

begin

readln(n);

for i:=1 to n do

begin

f[i]:=1;

read(q[i]);

end;

end;

function plus(x,y:hp):hp;

var

temp:hp;

i,len:integer;

begin

fillchar(temp,sizeof(temp),0);

if x.len>y.len then len:=x.len else len:=y.len;

for i:=1 to len do

begin

inc(temp.s[i],x.s[i]+y.s[i]);

if temp.s[i]>=10 then

begin

dec(temp.s[i],10);

inc(temp.s[i+1]);

end;

end;

while temp.s[len+1]>0 do inc(len);

temp.len:=len;

exit(temp);

end;

procedure dp;

var

i,j,len:integer;

visit:array[1..maxh] of boolean;

sum:hp;

begin

len:=1;

for i:=2 to n do

for j:=i-1 downto 1 do

begin

if (q[i]<q[j]) and (f[i]<f[j]+1) then f[i]:=f[j]+1;

if f[i]>len then len:=f[i];

end;

for i:=1 to n do

begin

if f[i]=1 then

begin

count[i].len:=1;

count[i].s[1]:=1;

continue;

end;

fillchar(visit,sizeof(visit),0);

for j:=i-1 downto 1 do

begin

if (f[i]=f[j]+1)and not visit[q[j]] and (q[i]<q[j]) then

begin

visit[q[j]]:=true;

count[i]:=plus(count[i],count[j]);

end;

end;

end;

fillchar(visit,sizeof(visit),0);

sum.len:=1;

sum.s[1]:=0;

for i:=n downto 1 do

if (f[i]=len)and not visit[q[i]] then

begin

visit[q[i]]:=true;

sum:=plus(sum,count[i]);

end;

write(len,’ ’);

for i:=sum.len downto 1 do

write(sum.s[i]);

writeln;

end;

begin

init;

dp;

close(input);

close(output);

end.

怎么80分叻?

大牛来看看啊!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

#1 小小小学生@2009-05-07 02:03:00
回复 删除
你的程序好长好长。。。。
#2 liguohao1994@2009-05-07 05:55:00
回复 删除
??????????????/

这题解法有简单点的。

可我这程序就是80分

#3 liguohao1994@2009-05-07 05:58:00
回复 删除
状态: Unaccepted

测评机: Xeost[5]

得分: 80分

提交日期: 2009-5-6 22:33:00

有效耗时: 906毫秒

测试结果1: 通过本测试点|有效耗时172ms

测试结果2: 通过本测试点|有效耗时63ms

测试结果3: 通过本测试点|有效耗时47ms

测试结果4: 通过本测试点|有效耗时63ms

测试结果5: 通过本测试点|有效耗时46ms

测试结果6: 通过本测试点|有效耗时172ms

测试结果7: 通过本测试点|有效耗时171ms

测试结果8: 通过本测试点|有效耗时172ms

测试结果9: 运行错误|普通保护错误

测试结果10: 运行错误|普通保护错误

我无语了。

#4 xxwzy@2009-05-07 06:16:00
回复 删除
要么空间爆了

要么数组溢出了

我读程能力太差了……

#5 liguohao1994@2009-05-07 06:31:00
回复 删除
改成LONGINT就行?

#6 liguohao1994@2009-05-07 06:33:00
回复 删除
状态: Unaccepted

测评机: Xeost[5]

得分: 80分

提交日期: 2009-5-7 21:32:00

有效耗时: 985毫秒

测试结果1: 通过本测试点|有效耗时172ms

测试结果2: 通过本测试点|有效耗时63ms

测试结果3: 通过本测试点|有效耗时62ms

测试结果4: 通过本测试点|有效耗时63ms

测试结果5: 通过本测试点|有效耗时63ms

测试结果6: 通过本测试点|有效耗时187ms

测试结果7: 通过本测试点|有效耗时188ms

测试结果8: 通过本测试点|有效耗时187ms

测试结果9: 运行错误|普通保护错误

测试结果10: 运行错误|普通保护错误

耗时更多还是80

#7 liguohao1994@2009-05-15 08:21:00
回复 删除
终于AC456了,实际上只要改成30000就行

调试多次才成功

终于AC456了,实际上只要改成30000就行

调试多次才成功

终于AC456了,实际上只要改成30000就行

调试多次才成功

终于AC456了,实际上只要改成30000就行

调试多次才成功

查看更多回复
提交回复