#include using namespace std; #include using namespace atcoder; using ll = long long; int h,w; vector> G; using P = pair; int dx[] = {1,0,-1,0},dy[] = {0,1,0,-1}; void solve(){ queue

Q; queue

Qp; bool is = false; vector> visited(h,vector(w)); for(int i = 0;i=h||ny<0||ny>=w)continue; if(G[x][y]==G[nx][ny]){ if(visited[nx][ny]==curIdx&&nx!=px&&ny!=py){ //cout<> w >> h; G = vector>(h,vector(w)); for(int i = 0;i> G[i][j]; } } solve(); }