比赛 |
20101025 |
评测结果 |
AWWWWWWWWW |
题目名称 |
逛街 |
最终得分 |
10 |
用户昵称 |
maxiem |
运行时间 |
0.000 s |
代码语言 |
Pascal |
内存使用 |
0.00 MiB |
提交时间 |
2010-10-25 21:43:10 |
显示代码纯文本
program shop;
var
data:array [1..300] of record
w,v,t,h:longint;
end;
f:array [0..1000,0..100] of longint;
cut:array [1..100000] of record
x,y:longint;
end;
value,a1,b1,a2,b2,top,i,j,n,x,y:longint;
begin
fillchar (f,sizeof(f),$FF);
fillchar (data,sizeof(data),0);
fillchar (cut,sizeof(cut),0);
assign (input,'shop.in');
reset (input);
readln (n,x,y);
for i:=1 to n do with data[i] do readln (w,v,t,h);
close (input);
assign (output,'shop.out');
rewrite (output);
top:=1;cut[top].x:=0;cut[top].y:=0;
f[0,0]:=0;
for i:=1 to n do begin
for j:=1 to top do begin
a1:=cut[j].x+data[i].w;b1:=cut[j].y+data[i].v;
a2:=cut[j].x+data[i].w*data[i].h;b2:=cut[j].y+data[i].v*data[i].h;
if (a1<=x) and (b1<=y) then begin
value:=f[cut[j].x,cut[j].y]+data[i].t;
if f[a1,b1]=-1 then begin
inc (top);
cut[top].x:=a1;cut[top].y:=b1;
f[a1,b1]:=value;
end
else if value>f[a1,b1] then f[a1,b1]:=value;
end;
if (a2<=x) and (b2<=y) then begin
value:=f[cut[j].x,cut[j].y]+data[i].t*data[i].h;
if f[a2,b2]=-1 then begin
inc(top);
cut[top].x:=a2;cut[top].y:=b2;
f[a2,b2]:=value;
end
else if value>f[a2,b2] then f[a2,b2]:=value;
end;
end;
end;
writeln (f[x,y]);
close (output);
end.