Raslboyy

https://codeforces.com/contest/462/problem/A

Sep 22nd, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     int n;
  9.     cin >> n;
  10.     vector<vector<bool>> vec(n + 2, vector<bool>(n + 2));
  11.     for (int i = 1; i <= n; i++)
  12.         for (int j = 1; j <= n; j++) {
  13.             char ch; cin >> ch;
  14.             vec[i][j] = 1 * (ch == 'o');
  15.         }
  16.     for (int i = 1; i <= n; i++)
  17.         for (int j = 1; j <= n; j++) {
  18.             if (int(vec[i - 1][j] + vec[i + 1][j] + vec[i][j - 1] + vec[i][j + 1]) % 2 != 0) {
  19.                 cout << "NO" << endl;
  20.                 return 0;
  21.             }
  22.         }
  23.     cout << "YES" << endl;
  24.  
  25.     return 0;
  26. }
Add Comment
Please, Sign In to add comment