#include #include #include #include #include #include #include #include #include #include using namespace std; //#define __int64 long long #define long __int64 #define REP(i,a,b) for(int i=a;i> to[i/4][i%4]; if(from[i/4][i%4] == to[i/4][i%4]){ check[i/4][i%4] = true; } } while(!func()){ for(veci=0; veci<4; veci++){ iy = nowy + Vecy[veci]; ix = nowx + Vecx[veci]; if(iy >= 0 && iy<4 && ix >= 0 && ix < 4){ if(from[iy][ix] == to[nowy][nowx]){ break; } } } if(veci == 4){ ans = false; break; } if(c[iy][ix] == true){ ans = false; break; } c[iy][ix] = true; swap(from[nowy][nowx], from[iy][ix]); nowy = iy; nowx = ix; } if(ans){ cout << "Yes" << endl; }else{ cout << "No" << endl; } return 0; }