记录编号 9994 评测结果 AAAAAAAAAA
题目名称 [USACO Open05] 疾病管理 最终得分 100
用户昵称 Gravatar.Xmz 是否通过 通过
代码语言 Pascal 运行时间 0.694 s
提交时间 2009-04-23 17:11:51 内存使用 0.18 MiB
显示代码纯文本
program xmz;
var
i,j,n,d,k,s,tt:longint;
x:array[1..1001,0..16]of longint;
y:array[1..16]of boolean;
f1,f2:text;
procedure zu(a,c:longint);
var
t,ss:longint;
begin
 for t:=a to d+1-c do
  begin
   y[t]:=true;
   if c<>1 then zu(t+1,c-1) else
   begin for i:=1 to n do
     begin
      ss:=0;
      if x[i,0]=0 then s:=s+1 else
      begin
       for j:=1 to x[i,0] do
        if not(y[x[i,j]]) then ss:=1;
       if ss=0 then s:=s+1;
      end;
     end;
      if s>tt then tt:=s;s:=0;
  end;
   y[t]:=false;
  end;

end;

begin
assign(f1,'disease.in');assign(f2,'disease.out');
reset(f1);rewrite(f2);
read(f1,n,d,k);
if k=0 then write(f2,31)
else
begin
for i:=1 to n do
 begin
  read(f1,x[i,0]);
  for j:=1 to x[i,0] do
   read(f1,x[i,j]);
 end;
tt:=0;
zu(1,k);
write(f2,tt);
end;
close(f1);close(f2);
end.