#include using namespace std; #define FOR(i,a,b) for(int i=(a);i<(b);i++) #define REP(i,n) FOR(i,0,n) #define ALL(v) (v).begin(),(v).end() template inline bool chmax(A &a, B b) { if (a inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; } typedef unsigned long long ull; typedef long long ll; typedef pair pii; typedef pair pll; typedef pair P; const ll INF = 1ll<<29; const ll MOD = 1000000007; const double EPS = 1e-10; int n, v, ox, oy; int l[200][200]; int dp[200][200][2]; int main() { cin >> n >> v >> ox >> oy; REP(i, n) REP(j, n) scanf("%d", &l[i][j]); ox--; oy--; memset(dp, -1, sizeof(dp)); priority_queue

pq; pq.push(P(pii(v, 1), pii(0, 0))); if (ox == 0 && oy == 0) pq.push(P(pii(v * 2, 0), pii(0, 0))); while (!pq.empty()) { P now = pq.top(); pq.pop(); int h = now.first.first; int f = now.first.second; int x = now.second.first; int y = now.second.second; if (!chmax(dp[y][x][f], h)) continue; static int dx[4] = {1,0,-1,0}, dy[4] = {0,1,0,-1}; REP(i, 4) { int nx = x + dx[i]; int ny = y + dy[i]; if (!(nx >= 0 && nx < n && ny >= 0 && ny < n)) continue; pq.push(P(pii(h - l[ny][nx], f), pii(nx, ny))); if (f && nx == ox && ny == oy) pq.push(P(pii((h - l[ny][nx]) * 2, 0), pii(nx, ny))); } } if (dp[n - 1][n - 1][0] <= 0 || dp[n - 1][n - 1][1] <= 0) puts("YES"); else puts("NO"); return 0; }