#pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include using namespace std; using ll = long long; const int INF = 1e9; const ll inf = 1LL<<60; template bool chmin(T& x, const T& y){ if(x <= y) return false; x = y; return true; } template bool chmax(T& x, const T& y){ if(x >= y) return false; x = y; return true; } void solve() { ll h, w, y, x; cin >> h >> w >> y >> x; y--; x--; vector> a(h, vector(w)); for (int i=0; i> a[i][j]; ll lv = a[y][x]; priority_queue, vector>, greater>> q; vector dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1}; vector> v(h, vector(w, false)); v[y][x] = true; for (int k=0; k<4; k++) { int nx = y + dx[k], ny = x + dy[k]; if (0 <= nx && nx < h && 0 <= ny && ny < w) { q.push({a[nx][ny], nx, ny}); v[nx][ny] = true; } } while (q.size()) { auto now = q.top(); q.pop(); int i = now[1], j = now[2]; ll p = now[0]; if (lv <= p) { cout << "No" << '\n'; return; } lv += p; for (int k=0; k<4; k++) { int nx = i + dx[k], ny = j + dy[k]; if (0 <= nx && nx < h && 0 <= ny && ny < w && !v[nx][ny]) { v[nx][ny] = true; q.push({a[nx][ny], nx, ny}); } } } cout << "Yes" << '\n'; } int main() { ios::sync_with_stdio(false); std::cin.tie(nullptr); // int t; cin >> t; /*while (t--)*/ solve(); }