amine99

Untitled

Apr 25th, 2018
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.12 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. #define io ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
  5. #define PB push_back
  6. #define MP make_pair
  7. #define F first
  8. #define S second
  9. typedef long long LL;
  10. typedef vector<int> VI;
  11. typedef pair<int,int> PI;
  12.  
  13. bool compare(const pair<int, int>&i, const pair<int, int>&j) {
  14.     return i.first > j.first;
  15. }
  16.  
  17. char a[101][101];
  18. int n,k,mc,ml,mx;
  19.  
  20. int main() {
  21.    io;
  22.    cin >> n >> k;
  23.    for(int i = 0 ; i < n ; i++)
  24.       for(int j = 0 ; j < n ; j++)
  25.          cin >> a[i][j];
  26.    for(int i = 0 ; i < n ; i++) {
  27.    int m = 0;
  28.       for(int j = 0 ; j < n ; j++) {
  29.          if(m >= k && m > mx) {
  30.             ml = i+1;
  31.             mx = m;
  32.          }
  33.          if(a[i][j] == '.')
  34.             m++;
  35.          else
  36.             m = 0;
  37.       }
  38.    }
  39.    mx = 0;
  40.    for(int j = 0 ; j < n ; j++) {
  41.    int m = 0;
  42.       for(int i = 0 ; i < n ; i++) {
  43.          if(m >= k && m > mx) {
  44.             mc = j+1;
  45.             mx = m;
  46.          }
  47.          if(a[i][j] == '.')
  48.             m++;
  49.          else
  50.             m = 0;
  51.       }
  52.    }
  53.    cout << ml << " " << mc;
  54. }
Add Comment
Please, Sign In to add comment