记录编号 8244 评测结果 AAAAAAAAAA
题目名称 [BYVoid S1] 灵魂分流药剂 最终得分 100
用户昵称 Gravatarbing 是否通过 通过
代码语言 Pascal 运行时间 0.103 s
提交时间 2008-11-13 13:03:55 内存使用 0.16 MiB
显示代码纯文本
program bing;
type
 meifa=record
 w,v,p:longint;
end;
var
 f1,f2:text;
 n,m,a,b:longint;
 w,v,t,p:longint;
 am:array[1..10] of longint;
 zh:array[1..10,1..100] of meifa;
 f:array[0..100,0..100] of longint;
procedure init;
var
 i,j:longint;
begin
 assign(f1,'soultap.in');reset(f1);
 assign(f2,'soultap.out');rewrite(f2);
 readln(f1,n,m,a,b);
 fillchar(am,sizeof(am),0);
 fillchar(f,sizeof(f),0);
 for i:=1 to n do
 begin
  readln(f1,w,v,t,p);
  inc(am[t]);
  zh[t,am[t]].w:=w;
  zh[t,am[t]].v:=v;
  zh[t,am[t]].p:=p;
 end;
end;
procedure nb;
var
 i,j,k,l:longint;
begin
 for k:=1 to m do
 for i:=a downto 1 do
 for j:=b downto 1 do
   for l:=1 to am[k] do
   if (i-zh[k,l].w>=0)and(j-zh[k,l].v>=0) then
    begin
     if f[i-zh[k,l].w,j-zh[k,l].v]+zh[k,l].p>f[i,j]
     then f[i,j]:=f[i-zh[k,l].w,j-zh[k,l].v]+zh[k,l].p;
    end;
end;
begin
 init;
 nb;
 write(f2,f[a,b]);
 close(f1);close(f2);
end.