People! I really do need help : I ve sent this freaking problem 5 freaking times, still havent got it accepted. I know the algorythm, just dont know why the tester sais its wrong...(c my code)
Program task1249;
 
Type arr = array [1..3000] of integer;
 
Var A,B        : arr;
    ans        : boolean;
    i,j,k,N,M  : integer;
 
Begin
  Readln(N,M); Ans:=true;
 
  For i:=1 to M do Read(B[i]);
 
  For i:=1 to N-1 do Begin
    A:=B;
    For j:=1 to M do Read(B[j]);
 
    For j:=1 to M-1 do Begin
      k:=0;
      If A[j]=1 then Inc(k,1);
      If A[j+1]=1 then Inc(k,2);
      If B[j]=1 then Inc(k,4);
      If B[j+1]=1 then Inc(k,8);
      If k in [14,13,11,7] then Ans:=false;
    End;
  End;
  If Ans then writeln('Yes') Else writeln('No');
End.