Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- using namespace std;
- int main()
- {
- int n;
- cin >> n;
- vector<vector<bool>> vec(n + 2, vector<bool>(n + 2));
- for (int i = 1; i <= n; i++)
- for (int j = 1; j <= n; j++) {
- char ch; cin >> ch;
- vec[i][j] = 1 * (ch == 'o');
- }
- for (int i = 1; i <= n; i++)
- for (int j = 1; j <= n; j++) {
- if (int(vec[i - 1][j] + vec[i + 1][j] + vec[i][j - 1] + vec[i][j + 1]) % 2 != 0) {
- cout << "NO" << endl;
- return 0;
- }
- }
- cout << "YES" << endl;
- return 0;
- }
Add Comment
Please, Sign In to add comment