Advertisement
SorahISA

2019 NHSPC north1 pD

Nov 12th, 2019
272
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.22 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. #define IOS ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
  5. #define X first
  6. #define Y second
  7. #define Push push_back
  8. #define ALL(x) x.begin(), x.end()
  9.  
  10. using lli = long long;
  11. using pll = pair<lli, lli>;
  12. using Double = long double;
  13. template<typename T>
  14. using Vector = vector<vector<T>>;
  15. template<typename T>
  16. using prior = priority_queue<T>;
  17.  
  18. int main() {
  19.     IOS;
  20.     int n, m;
  21.     cin >> n >> m;
  22.    
  23.     vector<string> mp(n);
  24.     for (auto &x : mp) cin >> x;
  25.    
  26.     vector<int> row(n, 0), col(m, 0), ls(n + m - 1, 0), rs(n + m - 1, 0);
  27.     for (int i = 0; i < n; ++i) {
  28.         for (int j = 0; j < m; ++j) {
  29.             if (mp[i][j] == 'x') {
  30.                 ++row[i];
  31.                 ++col[j];
  32.                 ++ls[i + m - 1 - j];
  33.                 ++rs[i + j];
  34.             }
  35.         }
  36.     }
  37.    
  38.     for (int i = 0; i < n; ++i) {
  39.         for (int j = 0; j < m; ++j) {
  40.             if (mp[i][j] == 'x') {
  41.                 if (row[i] > 1 or col[j] > 1 or ls[i + m - 1 - j] > 1 or rs[i + j] > 1) {
  42.                     cout << '(' << i << ',' << j << ')';
  43.                 }
  44.             }
  45.         }
  46.     }
  47.    
  48.     cout << "\n";
  49.  
  50.     return 0;
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement