比赛 20100420 评测结果 AWWETTE
题目名称 圆桌会议B 最终得分 14
用户昵称 reamb 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2010-04-20 11:45:12
显示代码纯文本
program yuanzhuohuiyi;
var
  e,c,n,i,p,t,z,u:longint;
  a:array[1..40,1..40]of integer;
  q:array[1..40] of integer;
  biaozhi:array[1..40] of boolean;
  jilu:array[1..10000,1..40]of longint;
procedure sousuo(k:integer);
var
  j:integer;
begin
  for j:=1 to n do
    if (a[q[k-1],j]=0) and (a[j,q[k-1]]=0)
    and biaozhi[j]=true then
    begin
      biaozhi[j]:=false;
      q[k]:=j;
      if k=n then
      begin
        if (a[j,1]=0)and(a[1,j]=0) then
        begin
          t:=t+1;
          for z:=1 to n do
            jilu[t,z]:=q[z]
        end
      end
      else
          sousuo(k+1);
      biaozhi[j]:=true
    end
end;
begin
  assign (input,'dislike.in');
  reset (input);
  assign (output,'dislike.out');
  rewrite (output);
    readln (c,n);
    while c<>0 do
    begin
      for i:=1 to n do
      begin
        for p:=1 to n do
          read (a[i,p]);
        readln
      end;
        for i:=2 to n do
          if (a[1,i]=0) and (a[i,1]=0) then
          begin
            q[1]:=1;
            q[2]:=i;
            for e:=1 to n do
              biaozhi[e]:=true;
            biaozhi[1]:=false;
            biaozhi[i]:=false;
            sousuo(3);
          end;
          t:=t div 2;
          writeln (c,' ',t);
          for z:=1 to t do
          begin
            for u:=1 to n do
              write (jilu[z,u],' ');
            writeln
          end;
          t:=0;
          readln (c,n);
    end;
  close (input);
  close (output)
end.