#include #define syosu(x) fixed< P; typedef pair pdd; typedef pair pll; typedef vector vi; typedef vector vvi; typedef vector vd; typedef vector vvd; typedef vector vl; typedef vector vvl; typedef vector vs; typedef vector

vp; typedef vector vvp; typedef vector vpll; typedef pair pip; typedef vector vip; const int inf=1<<29; const ll INF=1ll<<60; const double pi=acos(-1); const double eps=1e-18; const ll mod=1e9+7; const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1}; class Graph{ private: int n; vvp g; public: int DIJ(int s,int t){ priority_queue

q; vi d(n,inf); d[s]=0; q.push({0,s}); while(!q.empty()){ P p=q.top(); q.pop(); int v=p.second; if(d[v]<-p.first) continue; for(auto i:g[v]){ int u=i.first,D=d[v]+i.second; if(d[u]>D){ d[u]=D; q.push({-D,u}); } } } return d[t]; } Graph(int v){ n=v; g=vvp(v); } void add_edge(int s,int t,int c){ g[s].push_back({t,c}); } }; int n,m,x,y; vvi a; int main(){ cin>>n>>m>>y>>x; x--;y--; a=vvi(n,vi(n)); for(int i=0;i>a[i][j]; Graph g(n*n); for(int i=0;i=0&&X=0&&Yg.DIJ(0,n*n-1)||x>=0&&(m-g.DIJ(0,x*n+y))*2>g.DIJ(x*n+y,n*n-1)) cout<<"YES"<