某岛

… : "…アッカリ~ン . .. . " .. .
August 7, 2010

Summer Contest IX. 搜索练习 Round B

Background :

只做出一道Problems C,Astar (中间出现点故障。。导致交了这么多次 ╯﹏╰)
读题,前两道都是我做过但做不上来的。。。(第一题是去年NOIP挂掉的数独题,第二题是我USACO卡住的题。。。)
于是心想,这下只有死磕C了。。。于是开始死磕C。。。

考虑到可能有人会需要,代码贴这里。。。

#include 
#include 
#include 

using namespace std;
const int dx[4] = {0,0,1,-1};
const int dy[4] = {1,-1,0,0};

struct state{
    int s, l;
    int g, h, f;
    friend bool operator <(state a, state b){
        return a.f>b.f;
    }
};
state u, v;


bool hash[1679617];
priority_queue Q;
char map[8][8]; int hh[7][7];
int px[4], py[4], ux, uy, vx, vy;
int x0, y0; int ans;
int n, m, h0;


int qx[8*8], qy[8*8];
int head, tail;


int encode(){
    int s = 0;
    for (int i=0;i=0;i--){
        py[i] = (s%6) + 1; s /= 6;
        px[i] = (s%6) + 1; s /= 6;
    }
}



void init(){
    cin >> n >> m;

    memset(map, 'X', sizeof(map));
    for (int i=1;i<=n;i++)
        for (int j=1;j<=n;j++){
            cin >> map[i][j];
            if (map[i][j]=='O') x0 = i, y0 = j;
            else if (map[i][j]!='.'&&map[i][j]!='X') px[int(map[i][j])-49] = i, py[int(map[i][j])-49] = j ,map[i][j]='.';
        }

    v.s = encode();
    memset(hh, -1, sizeof(hh));
    qx[0] = x0; qy[0] = y0;

    head = 0; tail = 1;  hh[x0][y0] = 0; map[x0][y0] = '.';

    int x, y, xx, yy;
    while (head> t;
}




bool crash(){
    if (map[vx][vy]=='X') return true;
    for (int i=u.l;i> T;
    for (int i=0;i