-
Notifications
You must be signed in to change notification settings - Fork 67
/
Copy path1150 B. Tiling Challenge.cpp
53 lines (52 loc) · 1.3 KB
/
1150 B. Tiling Challenge.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
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pb push_back
#define fastread() (ios_base:: sync_with_stdio(false),cin.tie(NULL));
using namespace std;
int main()
{
fastread();
//freopen("input.txt","r", stdin);
ll n;
cin>>n;
char a[n+5][n+5];
for(int i=0; i<n; i++){
for(int j=0; j<n; j++){
cin>>a[i][j];
}
}
for(int i=0; i<n; i++){
for(int j=0; j<n; j++){
if(a[i][j] == '.'){
if((a[i+1][j-1] == '.' && a[i+1][j+1] == '.') && (a[i+1][j] == '.')){
if(a[i+2][j] == '.'){
if(i < n && j < n){
a[i][j] = a[i+1][j-1] = a[i+1][j] = a[i+1][j+1] = a[i+2][j] = '#';
}
}
}
}
}
}
bool ok = false;
for(int i=0; i<n; i++){
for(int j=0; j<n; j++){
if(a[i][j] == '#'){
ok = true;
}
else{
ok = false;
break;
}
}
if(ok == false)break;
}
if(ok){
cout<<"YES\n";
}
else{
cout<<"NO\n";
}
return 0;
}