#include #include using namespace std; using namespace atcoder; using ll = long long; using ld = long double; using mint = modint998244353; int h, w, x, y; ll a[550][550]; bool f[550][550]; priority_queue, vector>, greater>> pq; int dx[4] = {-1, 0, 0, 1}; int dy[4] = {0, -1, 1, 0}; void add(ll id) { int x = id / w; int y = id % w; for (int i = 0; i < 4; i++) { int nx = x + dx[i]; int ny = y + dy[i]; if (0 > nx || nx >= h || 0 > ny || ny >= w) continue; if (f[nx][ny]) continue; f[nx][ny] = true; pq.push({a[nx][ny], nx * w + ny}); } } int main() { cin >> h >> w >> x >> y; x--, y--; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) cin >> a[i][j]; } ll at = a[x][y]; f[x][y] = true; add(x * w + y); while (!pq.empty()) { auto [x, id] = pq.top(); pq.pop(); if (at > x) { at += x; } else { cout << "No" << endl; return 0; } add(id); } cout << "Yes" << endl; return 0; }