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

why am i getting WA in test 12
Posted by Grandmaster 11 Nov 2017 01:59
#include <stdio.h>
#include <iostream>
using namespace std;
int n, m, segRez[3004];
int segm1[3004];
char segm2[6005];
int main()
{
    cin >> n >> m;
    for(int i = 0; i < n; ++i){
        gets_s(segm2);
        for(int j = 0; j < m; ++j){
            segRez[j] = segm1[j] + int(segm2[j<<1] - 48);
            segm1[j] = int(segm2[j<<1] - 48);
            if(j - 1 >= 0 && ((segRez[j - 1]|segRez[j])) == 3){
                cout << "No";
                return 0;
            }
        }
    }
    cout << "Yes";
}