-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path241C_Connect-6.cpp
52 lines (50 loc) · 974 Bytes
/
241C_Connect-6.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
#include <iostream>
#include <string>
using namespace std;
bool check(int cnt){
if(cnt >= 4){
cout << "Yes";
return 1;
}
return 0;
}
int main() {
int n;
cin >> n;
string s[n];
for(string &it : s) cin >> it;
for(int x = 0;x<n;x++){
for(int y = 0;y<n;y++){
if(x+5<n){
int cnt = 0;
for(int m = 0;m<6;m++){
cnt+=(s[y][x+m] == '#');
}
if(check(cnt)) return 0;
}
if(y+5<n){
int cnt = 0;
for(int m = 0;m<6;m++){
cnt+=(s[y+m][x] == '#');
}
if(check(cnt)) return 0;
}
if(x+5<n && y+5 < n){
int cnt = 0;
for(int m = 0;m<6;m++){
cnt+=(s[y+m][x+m] == '#');
}
if(check(cnt)) return 0;
}
if(x+5<n && y-5>=0){
int cnt = 0;
for(int m = 0;m<6;m++){
cnt+=(s[y-m][x+m] == '#');
}
if(check(cnt)) return 0;
}
}
}
cout << "No";
return 0;
}