#include using namespace std; #define FOR(i,a,b) for(int i=(a);i<(b);i++) #define mp make_pair #define pb push_back typedef long long ll; templateusing V=vector; templateusing VV=V>; const int N = 200; struct Dijk{ typedef long long ll; const ll tinf = 1e18; int n; vector d; vector p; void solve(const vector>>&E, int S, int G=-1){ n = E.size(); d = vector(n, tinf); p = vector(n, -1); d[S] = 0; priority_queue,vector>,greater>> Q; Q.push(pair(0, S)); while(!Q.empty()){ pair t=Q.top(); Q.pop(); if(t.second == G) return; if(t.first > d[t.second]) continue; for(auto itr = E[t.second].begin(); itr != E[t.second].end(); itr++){ ll k = t.first + itr->second; int m = itr->first; if(k < d[itr->first]){ d[m] = k; p[m] = t.second; Q.push(pair(k, m)); } } } } } dijk; int n, v, x, y, L[N][N]; VV> E; main(){ cin.tie(0); ios::sync_with_stdio(false); cin >> n >> v >> y >> x; E.resize(n*n); FOR(i, 0, n)FOR(j, 0, n) cin >> L[i][j]; FOR(i, 0, n)FOR(j, 0, n){ if(i < n-1){ E[i*n+j].pb(mp((i+1)*n+j, L[i+1][j])); E[(i+1)*n+j].pb(mp(i*n+j, L[i][j])); } if(j < n-1){ E[i*n+j].pb(mp(i*n+j+1, L[i][j+1])); E[i*n+j+1].pb(mp(i*n+j, L[i][j])); } } dijk.solve(E, 0); if(dijk.d[n*n-1] < v){ cout << "YES" << endl; return 0; } if(x){ x--; y--; int c = dijk.d[x*n+y]; dijk.solve(E, x*n+y); if(dijk.d[n*n-1] < (v-c)*2){ cout << "YES" << endl; return 0; } } cout << "NO" << endl; return 0; }