-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path462A-appleman-and-easy-task.cpp
54 lines (54 loc) · 1.02 KB
/
462A-appleman-and-easy-task.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include <iostream>
using namespace std;
int main()
{
int n, i, j, c;
cin >> n;
bool even = true;
char ch[n][n];
for (i = 0; i < n; i++)
{
for (j = 0; j < n; j++)
{
cin >> ch[i][j];
}
}
for (i = 0; i < n; i++)
{
c = 0;
for (j = 0; j < n; j++)
{
if (i - 1 >= 0 and ch[i - 1][j] == 'o')
{
c++;
}
if (i + 1 < n and ch[i + 1][j] == 'o')
{
c++;
}
if (j - 1 >= 0 and ch[i][j - 1] == 'o')
{
c++;
}
if (j + 1 < n and ch[i][j + 1] == 'o')
{
c++;
}
if (c % 2 == 1)
{
even = false;
break;
}
}
if (even == false)
{
cout << "NO" << endl;
break;
}
}
if (even)
{
cout << "YES" << endl;
}
return 0;
}