记录编号 384631 评测结果 AAAAAAAAAA
题目名称 [USACO Nov06] 牧场的安排 最终得分 100
用户昵称 Gravatar转瞬の电流 是否通过 通过
代码语言 Pascal 运行时间 0.002 s
提交时间 2017-03-18 20:02:27 内存使用 0.60 MiB
显示代码纯文本
program mcdap;
var
i,j,k,m,n,s,u,v,w:longint;
f:array[0..20,0..5000]of longint;
a,c:array[0..5000]of longint;
ch:char;

function hf(x:longint):boolean;
var
o,p,q:longint;
begin
p:=1 and x;
for o:=1 to m-1 do
 begin
 q:=1 and (x shr o);
 if (p=1)and(q=1) then exit(false);
 p:=q;
 end;
 exit(true);
end;

begin
assign(input,'cowfood.in');
assign(output,'cowfood.out');
reset(input);
rewrite(output);
readln(n,m);
s:=0;
for i:=0 to 1 shl m -1 do
 if hf(i)=true then
 begin inc(s); c[s]:=i; end;
for i:=1 to n do
 begin
 v:=0;
 for j:=1 to m do
  begin
  read(w);
  v:=v shl 1;
  if w=0 then v:=v+1;
  end;
 a[i]:=v;
 readln;
 end;
for i:=1 to n+1 do
 for j:=1 to s+1 do
 f[i,j]:=0;
for i:=1 to s do
 if c[i]and a[1]=0 then f[1,i]:=1;
for i:=2 to n do
 for j:=1 to s do
 if c[j] and a[i]=0 then
  for k:=1 to s do
   if c[j] and c[k]=0 then f[i,j]:=f[i,j]+f[i-1,k];
w:=0;
for i:=1 to s do
 w:=w+f[n,i];
writeln(w mod 100000000);
{writeln(w);}
{for i:=1 to n do
begin
writeln;
for j:=1 to s do
write(f[i,j],' ');
end;
writeln; }
{for i:=1 to s do
writeln(c[i]);}
close(input);
close(output);
end.