#include using namespace std; inline bool in_grid(int i, int j, int h, int w) { return 0 <= i && i < h && 0 <= j && j < w; } const int di[] = {1, -1, 0, 0}; const int dj[] = {0, 0, 1, -1}; void solve(){ int h, w, t; cin >> h >> w >> t; pair ss, g; cin >> ss.first >> ss.second >> g.first >> g.second; --ss.first; --ss.second; --g.first; --g.second; vector> s(h, vector(w)); for(int i = 0;i < h; ++i){ for(int j = 0;j < w; ++j){ cin >> s[i][j]; s[i][j] -= '0'; } } vector init = s; vector ok(h, vector(w)); ok[ss.first][ss.second] = true; for(int ii = 1;ii < t; ++ii){ for(int i = 0;i < h; ++i){ for(int j = 0;j < w; ++j){ if(s[i][j] == 0){ s[i][j] = init[i][j]; } else { --s[i][j]; } } } vector nok(h, vector(w)); for(int i = 0;i < h; ++i){ for(int j = 0;j < w; ++j){ if(!ok[i][j])continue; nok[i][j] = true; for(int d = 0;d < 4; ++d){ int ni = i + di[d]; int nj = j + dj[d]; if(!in_grid(ni, nj, h, w))continue; if(s[ni][nj] == 0)continue; nok[ni][nj] = true; } } } ok = move(nok); if(ok[g.first][g.second]){ cout << "Yes" << endl; return; } } cout << "No" << endl; } int main() { ios::sync_with_stdio(false); std::cin.tie(nullptr); cout<