func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAXN = 505;   const int MAXQ = 5000005;   int n, m, X1[MAXQ], X2[MAXQ], Y1[MAXQ], Y2[MAXQ];   bool ans[MAXQ];   bitset<MAXN> dp1[MAXN][MAXN], dp2[MAXN][MAXN], temp;   char board[MAXN][MAXN];   void dnc(int r1, int r2, vector<int> &que) {     if (que.empty() || r1 > r2) return;     int mid = (r1 + r2) / 2;     for (int i = r1; i <= r2; ++i) {       for (int j = 1; j <= m; ++j) {         dp1[i][j].reset();         dp2[i][j].reset();       }     }     for (int i = mid; i >= r1; --i) {       for (int j = m; j >= 1; --j) {         if (board[i][j] ==  # ) continue;         if (i == mid)           dp1[i][j].set(j);         else           dp1[i][j] |= dp1[i + 1][j];         if (j < m) dp1[i][j] |= dp1[i][j + 1];       }     }     for (int i = mid; i <= r2; ++i) {       for (int j = 1; j <= m; ++j) {         if (board[i][j] ==  # ) continue;         if (i == mid)           dp2[i][j].set(j);         else           dp2[i][j] |= dp2[i - 1][j];         if (j > 1) dp2[i][j] |= dp2[i][j - 1];       }     }     vector<int> q1, q2;     for (int i = 0; i < que.size(); ++i) {       int pos = que[i];       if (X1[pos] <= mid && X2[pos] >= mid) {         temp = (dp1[X1[pos]][Y1[pos]] & dp2[X2[pos]][Y2[pos]]);         ans[pos] = temp.any();       } else if (X2[pos] < mid)         q1.push_back(pos);       else         q2.push_back(pos);     }     dnc(r1, mid - 1, q1);     dnc(mid + 1, r2, q2);   }   int main() {     scanf( %d %d , &n, &m);     for (int i = 1; i <= n; ++i) scanf( %s , board[i] + 1);     int q;     vector<int> que;     scanf( %d , &q);     for (int i = 0; i < q; ++i) {       scanf( %d %d %d %d , &X1[i], &Y1[i], &X2[i], &Y2[i]);       que.push_back(i);     }     dnc(1, n, que);     for (int i = 0; i < q; ++i) {       if (ans[i])         printf( Yes n );       else         printf( No n );     }     return 0;   }   