char c[102][102]; { ll@h,@w,@u,@d,@r,@l,@k,@p,@xs,@ys,@xt,@yt; rep(x,h)rd(c[x+1]+1); w+=2; h+=2; DijkstraHeapj; j.walloc(h*w,1); j.change(xs*w+ys,0); j.change(xt*w+yt,k+1); while(j.size){ ll xy=j.pop(),x=xy/w,y=xy%w,v=j.val[xy],a; if(a=c[x-1][y],a=='.'||a=='@'){ j.change((x-1)*w+y,v+u+p*(a=='@')); } if(a=c[x+1][y],a=='.'||a=='@'){ j.change((x+1)*w+y,v+d+p*(a=='@')); } if(a=c[x][y-1],a=='.'||a=='@'){ j.change(x*w+(y-1),v+l+p*(a=='@')); } if(a=c[x][y+1],a=='.'||a=='@'){ j.change(x*w+(y+1),v+r+p*(a=='@')); } } ll v=j.val[xt*w+yt]; wt("v=",v); wt(v>k?"No":"Yes"); }