func_code_string: #include <bits/stdc++.h>   using namespace std;   #pragma warning(disable : 4996)   #pragma comment(linker,  /STACK:20000007 )   #pragma GCC optimize( unroll-loops )   const int N = (int)1e6 + 100;   const int maxn = (int)1e3 + 100;   const int base = (int)1e9;   const int mod = (int)1e9 + 7;   const int inf = INT_MAX;   const long long ll_inf = LLONG_MAX;   const long double PI = acos((long double)-1.0);   const long double eps = 1e-8;   int n, m, k;   char ch[1003][1003];   bool mark[1003][1003];   int d[1003][1003];   int x, y, x1, y2;   vector<int> dx = {1, 0, -1, 0};   vector<int> dy = {0, -1, 0, 1};   void bfs(int x, int y) {     d[x][y] = 1;     queue<pair<int, int> > Q;     Q.push(make_pair(x, y));     while (!Q.empty()) {       auto P = Q.front();       Q.pop();       int x, y;       tie(x, y) = P;       mark[x][y] = true;       if (x == x1 && y == y2) return;       for (int i = 0; i < 4; ++i) {         for (int j = 1; j <= k; ++j) {           int r = x, c = y;           r += dx[i] * j;           c += dy[i] * j;           if (r < 1 || c < 1 || c > m || r > n ||               (ch[r][c] ==  #  || (d[r][c] && d[r][c] <= d[x][y])))             break;           if (d[r][c] > d[x][y] + 1) {             d[r][c] = min(d[r][c], d[x][y] + 1);             Q.push({r, c});           } else if (!d[r][c]) {             d[r][c] = d[x][y] + 1;             Q.push({r, c});           }         }       }     }   }   void solve() {     cin >> n >> m >> k;     for (int i = 1; i <= n; ++i) {       for (int j = 1; j <= m; ++j) {         cin >> ch[i][j];       }     }     cin >> x >> y >> x1 >> y2;     bfs(x, y);     cout << --d[x1][y2] <<   n ;   }   int main() {     int T = 1;     for (; T; --T) solve();     return 0;   }   