ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1249. Ancient Necropolis

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)
Posted by Alex[LSD] 29 Apr 2003 10:03
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.