If condition doesn 't satisfy
if ( black < 2 * ( max ( N , M ) ) ) { cout << " NO " << endl ; return ; } vector < vector < bool > > visited ; for ( int i = 0 ; i < N ; i ++ ) { vector < bool > temp ; for ( int j = 0 ; j < M ; j ++ ) { temp . push_back ( false ) ; } visited . push_back ( temp ) ; }