记录编号 |
8290 |
评测结果 |
AAAAATAAAA |
题目名称 |
[BYVoid S1] 灵魂分流药剂 |
最终得分 |
90 |
用户昵称 |
chengyang |
是否通过 |
未通过 |
代码语言 |
Pascal |
运行时间 |
2.636 s |
提交时间 |
2008-11-13 15:08:21 |
内存使用 |
0.11 MiB |
显示代码纯文本
program soultap;
var
a1,b1,m,n,max,k:longint;
mm:array[1..11]of boolean;
nn:array[1..101,1..5]of longint;
procedure ini;
var
i:longint;
begin
assign(input,'soultap.in');
assign(output,'soultap.out');
reset(input); rewrite(output);
readln(n,m,a1,b1);
for i:=1 to n do readln(nn[i,1],nn[i,2],nn[i,3],nn[i,4]);
for i:=1 to 10 do mm[i]:=true;
max:=0;
End;
procedure go(k,a2,b2,c:longint);
var
i,j:longint;
Begin
mm[nn[k,3]]:=false;
for i:=1 to n do begin
if (mm[nn[i,3]]) and (a2+nn[i,1]<=a1) and(b2+nn[i,2]<=b1) then begin
if c+nn[i,4]>max then max:=c+nn[i,4];
go(i,a2+nn[i,1],b2+nn[i,2],c+nn[i,4]);
end;
end;
mm[nn[k,3]]:=true;
End;
Begin
ini;
for k:=1 to n do begin
go(k,nn[k,1],nn[k,2],nn[k,4]);
end;
writeln(max);
close(input); close(output);
End.