讨论 / 80分 求神犇找错
wjltz 2012-10-22 03:04:00
点我顶贴 收藏 删除

状态: Unaccepted

测评机: Xeond[6]

得分: 80分

提交日期: 2011-9-7 23:02:00

有效耗时: 828毫秒

RQNOJ近期在线比赛列表

RQNOJ九月份月赛 时间:2011-9-24 18:30:00 [报名]

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

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

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

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

测试结果5: 测试结果错误.错误结果为:615

正确结果应为:510

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

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

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

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

测试结果10: 测试结果错误.错误结果为:428

正确结果应为:187

program lt1;

type arr=array[1..1000] of longint;

var f:array[0..1000] of longint;

a,b,c:arr;

p,t,n,m,i,j,ans:longint;

function max(x,y:longint):longint;

begin

if x>y then max:=x

else max:=y;

end;

procedure swap(x,y:longint; var a:arr);

var t:longint;

begin

t:=a[x];

a[x]:=a[y];

a[y]:=t;

end;

procedure kp(x,y:longint);

var i,j:longint;

begin

if x>=y then exit;

i:=x;

j:=y;

while i<j do

begin

while (i<j) and (a[i]<=a[j]) do inc(i);

swap(i,j,a);

swap(i,j,b);

swap(i,j,c);

while (i<j) and (a[i]<=a[j]) do dec(j);

swap(i,j,a);

swap(i,j,b);

swap(i,j,c);

end;

kp(x,i-1);

kp(i+1,y);

end;

begin

readln(m,n);

p:=0;

for i:=1 to n do

begin

readln(a[i],b[i],c[i]);

if c[i]>0 then p:=p+b[i];

end;

kp(1,n);

fillchar(f,sizeof(f),0);

f[0]:=10;

t:=1;

for i:=1 to n do

begin

for j:=m downto 0 do

if f[j]>=a[i] then

begin

if j+c[i]>=m then begin

writeln(a[i]);

halt;

end;

f[j+c[i]]:=f[j];

f[j]:=f[j]+b[i];

end;

end;

writeln(p+10);

end.

#1 wjltz@2011-09-08 02:25:00
回复 删除
if f[j+c[i]]<f[j] then f[j+c[i]]:=f[j];
#2 ahfy_zyt@2012-08-09 05:41:00
回复 删除
我的也是,尤其是第5个点
#3 烨毅@2012-10-22 03:04:00
回复 删除
回复 楼主wjltz 的帖子

我错的第五个点和你的一样,暂时还没找出原因,下面是我的代码:

var d,g,i,j,k,min,n,m,x,y:longint;

f,t,h:array[0..1001] of longint;

a:array[-1..101,-100..3001] of longint;

begin

fillchar(t,sizeof(t),0);

fillchar(f,sizeof(f),0);

fillchar(h,sizeof(h),0);

readln(d,g);

for i:=1 to g do readln(t[i],f[i],h[i]);

for i:=1 to g-1 do

for j:=i+1 to g do

if (t[i]>t[j]) then

begin

k:=t[i]; t[i]:=t[j]; t[j]:=k;

k:=f[i]; f[i]:=f[j]; f[j]:=k;

k:=h[i]; h[i]:=h[j]; h[j]:=k;

end;

//-------------------------------

fillchar(a,sizeof(a),0);

for i:=0 to g do

for j:=0 to 3000 do a[i,j]:=-1;

a[0,10]:=0;

for i:=1 to g do

for j:=0 to 50 do

begin

x:=-1;

if (j+t[i]-t[i-1]-f[i]>-1)and(j+t[i]-t[i-1]-f[i]<=3000) then

if (a[i-1,j+t[i]-t[i-1]-f[i]]>-1)and(j-f[i]>-1) then

x:=a[i-1,j+t[i]-t[i-1]-f[i]];

y:=-1;

if (j+t[i]-t[i-1]>-1)and(j+t[i]-t[i-1]<=3000) then

if (a[i-1,j+t[i]-t[i-1]]>-1) then

y:=a[i-1,j+t[i]-t[i-1]]+h[i];

if (x>y) then a[i,j]:=x else a[i,j]:=y;

//if (a[i,j]<>-1) then writeln(a[i,j],' ',i,' ',j,' ',j-f[i],' ',a[i-1,j-f[i]],' *');

if (a[i,j]>=d) then

begin

write(t[i]); halt;

end;

end;

m:=10; k:=10;

for i:=1 to g do

begin

dec(k,t[i]-t[i-1]);

if (k<0) then

begin

write(m); halt;

end;

inc(k,f[i]);

inc(m,f[i]);

end;

write(m);

end.

---------------------

测评机: Xeond[6]

得分: 90分

提交日期: 2012-10-22 12:54:00

有效耗时: 1546毫秒

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

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

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

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

测试结果5: 测试结果错误.错误结果为:615

正确结果应为:510

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

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

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

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

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

查看更多回复
提交回复