#include"bits/stdc++.h" //#include using namespace std; #define print(x) cout<= n || a + dx[i] < 0 || b + dy[i] >= n || b + dy[i] < 0)continue; d[a + dx[i]][b + dy[i]] = min(d[a + dx[i]][b + dy[i]], d[a][b] + l[a + dx[i]][b + dy[i]]); } } } int main() { cin >> n >> v >> ox >> oy; REP(i, n)REP(j, n) { cin >> l[i][j]; } dijkstra(0, 0); if (d[n-1][n-1] < v) { print("YES"); return 0; } int cost = d[ox-1][oy-1]; if (cost >= v) { print("NO"); return 0; } dijkstra(ox-1, oy-1); if (d[n-1][n-1] + cost < (v - cost) * 2) { print("YES"); return 0; } print("NO"); return 0; }