fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. #define endl '\n'
  5. #define int long long
  6.  
  7. const int N = 2e5, oo = 2e18, MOD = 1e9+7;
  8.  
  9. int dx[] = {0, 1, -1, 1, 0, -1, 1, -1};
  10. int dy[] = {1, 1, 1, 0, -1, -1, -1, 0};
  11.  
  12.  
  13.  
  14. void solve() {
  15. int n; cin >> n;
  16. vector<string> a(n);
  17. for (int i = 0; i < n; i++) cin >> a[i];
  18. for (int i = 0; i < n; i++) {
  19. for (int j = 0; j < n; j++) {
  20. int b[8] = {};
  21. for (int k = 0; k < 6; k++) {
  22. for (int c = 0; c < 8; c++) {
  23. int x = i + k * dx[c], y = j + k * dy[c];;
  24. if (x < 0 || y < 0 || x >= n || y >= n)
  25. continue;
  26. b[c] += (a[x][y] == '#');
  27. }
  28. }
  29. for (int k = 0; k < 8; k++) {
  30. if (b[k] >= 4) {
  31. cout << "Yes\n";
  32. return;
  33. }
  34. }
  35. }
  36. }
  37. cout << "No";
  38.  
  39. }
  40.  
  41.  
  42. signed main() {
  43. ios_base::sync_with_stdio(false);
  44. cin.tie(NULL); cout.tie(NULL);
  45. // #ifndef ONLINE_JUDGE
  46. // freopen("input.txt", "r", stdin);
  47. // freopen("output.txt", "w", stdout);
  48. // #endif
  49. int t; t = 1;
  50. // cin >> t;
  51. while (t--) solve();
  52. return 0;
  53. }
  54.  
Success #stdin #stdout 0s 5316KB
stdin
Standard input is empty
stdout
No