http://acm.hdu.edu.cn/showproblem.php?pid=1043
八数码八境界:
https://www.cnblogs.com/zufezzt/p/5659276.html
借用了MAP哈希,发现只能过hdu(249ms),poj一直TLE。
还是先上个代码吧,以后再改用康拓展开来哈希。。
1 #include<stdio.h> 2 #include<algorithm> 3 #include<string.h> 4 #include<cstring> 5 #include<iostream> 6 #include<queue> 7 #include<set> 8 #include<math.h> 9 #include<vector> 10 #include<functional> 11 #include<queue> 12 #include<map> 13 #define MAXN 100005 14 typedef long long ll; 15 using namespace std; 16 17 int fx[4][2]={1,0,-1,0,0,-1,0,1}; 18 char sum[400000][40]={0}; 19 char *lu="dulr"; 20 typedef struct Node{ 21 int x,y,num; 22 }node; 23 map<int,int>mp; 24 int tot=0; 25 26 void pre() 27 { queue<node>qe; 28 sum[0][0]='