#include #define rep(i,a,b) for(int i=int(a);i= N || ny < 0 || ny >= N)continue; if(rest[ny][nx] < v - table[ny][nx]){ rest[ny][nx] = v - table[ny][nx]; dfs(ny, nx, rest[ny][nx]); } } } main(){ cin >> N >> V >> X >> Y; rep(i,0,N)rep(j,0,N){ cin >> table[i][j]; rest[i][j] = 0; } dfs(0, 0, V); //if(X != 0 || Y != 0)cout << rest[Y-1][X-1] << endl; if(X != 0 || Y != 0){ dfs(Y-1, X-1, rest[Y-1][X-1] * 2); } //if(X != 0 || Y != 0)cout << rest[Y-1][X-1] << endl; string ans[] = {"NO", "YES"}; cout << ans[rest[N-1][N-1] > 0] << endl; }