Re: YES!!! I swap M,N & get AC!
{ ACCEPTED !!!!!!!!!! }
Var S : Array [0..1,1..3000] of Byte;
N,M,I,J,C : Longint;
Begin
{}
Read(M,N); { <-- Read(N,M); !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! }
C := 1;
For J:=1 to N do S[1-C,J] := 0; { Обнуляем "предыдущую" строку }
For I:=1 to M do { Цикл по всем строкам }
Begin
For J:=1 to N do Read(S[C,J]); { Читаем новую строку }
For J:=1 to N-1 do { Ищем неприятности ;) }
If (((S[1-C,J]=0) and (S[1-C,J+1]=1) and (S[C,J]=1) and (S
[C,J+1]=1)) or
((S[1-C,J]=1) and (S[1-C,J+1]=0) and (S[C,J]=1) and (S
[C,J+1]=1)) or
((S[1-C,J]=1) and (S[1-C,J+1]=1) and (S[C,J]=0) and (S
[C,J+1]=1)) or
((S[1-C,J]=1) and (S[1-C,J+1]=1) and (S[C,J]=1) and (S
[C,J+1]=0))) then
Begin
Writeln('No');
Halt;
End;
C := 1 - C;
End;
Writeln('Yes');
End.