// yukicodr // No.424 立体迷路 //#include "stdafx.h" #include #include #include //list #include //tree #include //連想配列 #include //hash #include //hash #include #include using namespace std; #define START (0) #define RIGHT (1) #define UP (2) #define LEFT (3) #define DOWN (4) //二次元可変配列 vector > mass; vector > memo; int H,W; int sx, sy, gx, gy; typedef struct DIR{ int dx; int dy; }DIR; DIR dir[8] = { //dx,dy 0, 1, //0 -1, 0, //1 0,-1, //2 1, 0, //3 0, 2, //4 -2, 0, //5 0,-2, //6 2, 0, //7 }; int ans = 0; char b[100][100]; char _b[100][100]; void printM(int x0, int y0, int nx, int ny, int dir_index) { cout << "x=" << x0 << ",y=" << y0 << ",nx=" << nx << ",ny=" << ny << ",dir_index=" << dir_index <= 1 && nx <= H) && (ny >= 1 && ny <= W) && (_b[nx][ny] != '1')) { switch (dir_index) { case 0: case 1: case 2: case 3: if ((abs(b[x][y] - b[nx][ny]) == 1) || (b[x][y] == b[nx][ny]))//隣り合っているブロックの絶対値が1か同じなら... { //座標を更新 x = nx; y = ny; //マップ更新 _b[x][y] = '1'; //cout << ">>>NEXT:" << "x=" << x << ",y=" << y << ",dir_index=" << dir_index << endl; //さらにその次に行く solve(x, y); //ここに戻ってくるのは行けたけどその先で失敗したとき //各種座標をもとに戻しておく _b[x][y] = '0'; x -= dir[dir_index].dx; y -= dir[dir_index].dy; //cout << "<<>>NEXT:" << "x=" << x << ",y=" << y << ",dir_index=" << dir_index << endl; //さらにその次に行く solve(x, y); //ここに戻ってくるのは行けたけどその先で失敗したとき //各種座標をもとに戻しておく _b[x][y] = '0'; x -= dir[dir_index].dx; y -= dir[dir_index].dy; //cout << "<<