#include using namespace std; int main(){ int n,v,ox,oy;cin >> n >> v >> ox >> oy; ox--,oy--; vector> a(n,vector(n)); for(int i=0;i> a[i][j]; } } int dp[n][n][2]; memset(dp,0,sizeof(dp)); if(v-a[0][0]<=0){ cout << "NO" << endl; return 0; } dp[0][0][0]=v-a[0][0]; int dx[4]={1,0,-1,0}; int dy[4]={0,1,0,-1}; queue,int>> q; q.push({{0,0},0}); while(!q.empty()){ int u=q.front().first.first,v=q.front().first.second,w=q.front().second; q.pop(); for(int i=0;i<4;i++){ int x=u+dx[i],y=v+dy[i]; if(x>=0&&x<=n-1&&y>=0&&y<=n-1){ if(dp[x][y][w]