/********include********/ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define popcount __builtin_popcount using namespace std; //#include /***/ //#include //#include #include #define rep(i,x) for(long long i=0;i=0;i--) #define rrepn(i,x) for(long long i=x;i>1;i--) #define REP(i,n,x) for(long long i=n;i(b))?(a):(b)) #define MIN(a,b) (((a)<(b))?(a):(b)) #define all(x) (x).begin(),(x).end() typedef long long int ll; typedef pair P; struct edge{double to, cost;}; ll V; #define MAX_V 901 //vectorG[MAX_V]; vectorG[MAX_V]; double d[MAX_V]; void back_pri_dijkstra(int s){ priority_queue,greater

>que; fill(d,d+V,INF); d[s]=0; que.push(P(0,s)); while(!que.empty()){ P p=que.top(); que.pop(); int v=p.second; if(d[v]d[v]+e.cost){ d[(ll)e.to]=d[v]+e.cost; que.push(P(d[(ll)e.to],e.to)); } } } } vector masu(1005); int main() { cin.tie(0); ios::sync_with_stdio(false); ll H,W; ll U,D,R,L,K,P; ll sh,sw,th,tw; cin>>H>>W; cin>>U>>D>>R>>L>>K>>P; cin>>sw>>sh>>tw>>th; for(ll i=1;i<=H;i++){ cin>>masu[i]; } for(ll i=1;i<=H*W;i++){ //if(masu[(i)/W+1][(i)%W]=='#')continue; if(i%W!=1){ if(masu[(i-1)/W+1][(i-1)%(W+1)]=='.'){ G[i].push_back({(double)i-1,(double)L}); } else if(masu[(i-1)/W+1][(i-1)%(W+1)]=='@'){ G[i].push_back({(double)i-1,(double)P}); } } if(i%W!=0){ if(masu[(i-1)/W+1][(i+1)%(W+1)]=='.'){ G[i].push_back({(double)i+1,(double)R}); } else if(masu[(i-1)/W+1][(i+1)%(W+1)]=='@'){ G[i].push_back({(double)i+1,(double)P}); } } if(i-H>0){ if(masu[(i-H-1)/W+1][(i)%(W+1)]=='.'){ G[i].push_back({(double)i-H,(double)U}); } else if(masu[(i-H-1)/W+1][(i)%(W+1)]=='@'){ G[i].push_back({(double)i-H,(double)P}); } } if(i+H<=H*W){ if(masu[(i+H-1)/W+1][(i)%(W+1)]=='.'){ G[i].push_back({(double)i+H,(double)D}); } else if(masu[(i+H-1)/W+1][(i)%(W+1)]=='@'){ G[i].push_back({(double)i+H,(double)P}); } } } for(ll i=1;i<=900;i++){ d[i]=INF; } back_pri_dijkstra((sh-1)*W+sw); if(d[(th-1)*W+tw]<=K){ cout<<"Yes"<<"\n"; } else{ cout<<"No"<<"\n"; } re 0; }