-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCodeForces-1150B.py
More file actions
31 lines (29 loc) · 812 Bytes
/
CodeForces-1150B.py
File metadata and controls
31 lines (29 loc) · 812 Bytes
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
n = int(input())
board = [input().strip() for _ in range(n)]
new = [['0' for _ in range(n)] for _ in range(n)]
for i in range(n):
for j in range(n):
if board[i][j] == '#':
new[i][j] = '1'
else:
new[i][j] = '0'
for i in range(n):
for j in range(n):
if new[i][j] == '0':
try:
if new[i+1][j-1] == '0' and new[i+1][j]=='0' and new[i+1][j+1] == '0' and new[i+2][j] == '0':
new[i][j] = '1'
new[i+1][j-1] = '1'
new[i+1][j] = '1'
new[i+1][j+1] = '1'
new[i+2][j] = '1'
except:
pass
possible = True
for x in new:
if '0' in x:
possible = False
if possible:
print('YES')
else:
print('NO')