#include using namespace std; typedef signed long long ll; #define _P(...) (void)printf(__VA_ARGS__) #define FOR(x,to) for(x=0;x<(to);x++) #define FORR(x,arr) for(auto& x:arr) #define FORR2(x,y,arr) for(auto& [x,y]:arr) #define ALL(a) (a.begin()),(a.end()) #define ZERO(a) memset(a,0,sizeof(a)) #define MINUS(a) memset(a,0xff,sizeof(a)) template bool chmax(T &a, const T &b) { if(a bool chmin(T &a, const T &b) { if(a>b){a=b;return 1;}return 0;} //------------------------------------------------------- int H,W,Y,X; ll A[555][555]; priority_queue> Q; void add(int y,int x) { int dd[4]={0,1,0,-1}; int i; FOR(i,4) { int ty=y+dd[i]; int tx=x+dd[i^1]; if(ty<0||ty>=H||tx<0||tx>=W) continue; if(A[ty][tx]==0) continue; Q.push({-A[ty][tx],ty*1000+tx}); A[ty][tx]=0; } } void solve() { int i,j,k,l,r,x,y; string s; cin>>H>>W>>Y>>X; Y--,X--; ll cur=A[Y][X]; A[Y][X]=0; add(Y,X); while(Q.size()) { if(-Q.top().first>=cur) break; y=Q.top().second/1000; x=Q.top().second%1000; cur+=-Q.top().first; Q.pop(); } FOR(y,H) FOR(x,W) if(A[y][x]) { cout<<"No"<