#include #define INF 10000000 using namespace std; int dp[200][200]; int N, V; int L[200][200]; int Ox, Oy; void recursive(int y, int x, int life) { if(dp[y][x] >= life) return; dp[y][x] = life; int d[4][2] = {{1,0}, {-1, 0}, {0, 1}, {0, -1}}; int ky, kx; int retval = 0; for(int i = 0; i < 4; i++) { ky = y + d[i][0], kx = x + d[i][1]; if(ky < 0 || N <= ky || kx < 0 || N <= kx) continue; recursive(ky, kx, life - L[ky][kx]); } } int main() { cin >> N >> V >> Ox >> Oy; for(int i = 0; i < N; i++) { for(int j = 0; j < N; j++) { cin >> L[i][j]; dp[i][j] = 0; } } recursive(0, 0, V); if(dp[Oy][Ox] > 0) recursive(Oy, Ox, 2 * dp[Oy][Ox]); if(dp[N - 1][N - 1] > 0) cout << "YES" << endl; else cout << "NO" << endl; return 0; }