-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTiling Challenge.cpp
More file actions
39 lines (34 loc) · 987 Bytes
/
Tiling Challenge.cpp
File metadata and controls
39 lines (34 loc) · 987 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
32
33
34
35
36
37
38
39
//Tiling Challenge
#include<bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
string s;
vector<vector<bool>> board(n,vector<bool>(n,false));
for(int i=0;i<n;i++) {
cin >> s;
for(int j = 0;j<n;j++) {
if(s[j] == '#') board[i][j] = true;
}
}
bool possible = true;
for(int i=0;i<n;i++) {
for(int j=0;j<n;j++) {
if(!board[i][j]) {
if(j - 1 >=0 && j + 1 < n && i + 2 < n && !board[i+1][j-1] && !board[i+1][j] && !board[i+1][j+1] && !board[i+2][j]) {
board[i+1][j-1] = true;
board[i+1][j] = true;
board[i+1][j+1] = true;
board[i+2][j] = true;
}
else {
possible = false;
break;
}
}
}
if(!possible) break;
}
possible ? cout << "YES" << endl : cout << "NO" << endl;
}