| 
 | 
back to boardWA#7,need help!!! who can help me? I WA on #7.Why?   here is my program: var   a:array[1..1000]of longint;   b:array[1..1000,1..1000]of boolean;   n,i,j,x,y,m:longint;   c:boolean;   function find(x,y:longint):boolean;     var       i:longint;     begin       if b[x,y] then exit(false);       for i:=1 to m do         if (b[a[i],x])and(b[a[i],y])then           begin             b[x,y]:=true;b[y,x]:=true;             exit(false);           end;       exit(true);     end;   begin   while not seekeof do     begin       readln(x,y);       b[x,x]:=true;b[y,y]:=true;       b[x,y]:=true;b[y,x]:=true;         c:=true;       for j:=1 to m do         if a[m]=x then begin c:=false;break;end;       if c then         begin           inc(m);a[m]:=x;           for i:=1 to m do             if find(a[i],x) then               begin                 writeln(0);halt;               end;         end;         c:=true;       for j:=1 to m do         if a[m]=y then begin c:=false;break;end;       if c then         begin           inc(m);a[m]:=y;           for i:=1 to m do             if find(a[i],y) then               begin                 writeln(0);halt;               end;         end;     end;   writeln(1); end. Re: WA#7,need help!!! Pls check for the following case:   5 6 5 8 5 9 6 7 8 9 9 10   Answer should be 1 Re: WA#7,need help!!! Test 7 has invert vertexes. 10 1 1 2   asn: 1   I have many times WA, because my programm doesnt check it.  |  
  | 
|