/** * @FileName a.cpp * @Author kanpurin * @Created 2022.05.20 23:29:04 **/ #include "bits/stdc++.h" using namespace std; typedef long long ll; int main() { int h,w,x,y; cin >> h >> w >> x >> y; x--;y--; vector> a(h,vector(w)); vector> used(h,vector(w)); for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { cin >> a[i][j]; } } using P = pair>; priority_queue,greater

> pq; int dx[] = {0,1,0,-1}; int dy[] = {1,0,-1,0}; for (int i = 0; i < 4; i++) { int nx = x + dx[i]; int ny = y + dy[i]; if (nx < 0 || ny < 0 || nx >= h || ny >= w || used[nx][ny]) continue; pq.push({a[nx][ny],{nx,ny}}); used[nx][ny] = true; } used[x][y] = true; ll total = a[x][y]; while(!pq.empty()) { auto p = pq.top(); pq.pop(); if (total <= p.first) { puts("No"); return 0; } total += p.first; for (int i = 0; i < 4; i++) { int nx = p.second.first + dx[i]; int ny = p.second.second + dy[i]; if (nx < 0 || ny < 0 || nx >= h || ny >= w || used[nx][ny]) continue; pq.push({a[nx][ny],{nx,ny}}); used[nx][ny] = true; } } puts("Yes"); return 0; }