比赛 NOIP2008集训模拟5 评测结果 WWWAAWWWWA
题目名称 疾病管理 最终得分 30
用户昵称 E.M.B.E.R 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2008-11-14 09:27:39
显示代码纯文本
program EmberAsh;
label 1;
type node=record
        p:longint;
        q:array[1..15]of longint;
        end;
var
a:array[0..15]of longint;//记录患第i种病的奶牛数
b:array[0..15]of boolean;//不能得的病
c:array[1..1000]of node;
i,j,k,n,d,m,max,min,jj,temp,t1,pp,ss:longint;
flag:boolean;
fin,fout:text;

BEGIN
assign(fin,'disease.in');reset(fin);
assign(fout,'disease.out');rewrite(fout);
readln(fin,n,d,k);
for i:=1 to n do
  begin
  with c[i] do
    begin
    read(fin,pp);
    for j:=1 to pp do
      begin
      read(fin,q[j]);
      inc(a[q[j]]);
      end;
    end;
  readln(fin);
  end;
//qsort(1,15);
temp:=0;
while temp<d-k do
  begin
  min:=maxlongint;
  for i:=1 to 15 do
    if (a[i]<min)and(a[i]<>0) then
      begin
      min:=a[i];
      t1:=i;
      end;
  b[t1]:=true;//患这种病的牛太少
  a[t1]:=0;
  inc(temp);
  end;
for i:=1 to n do
  begin
  flag:=true;
  with c[i] do
  for j:=1 to 15 do
    begin
    if b[q[j]]=true then
      begin
      flag:=false;
      goto 1;
      end;
    if q[j]=0 then goto 1;
    end;
  1:
  if flag=true then
    inc(ss);
  end;
writeln(fout,ss);
close(fin);close(fout);
END.