#include #include #include #include using namespace std; int dp[65550][17]; struct cmp { bool operator ()(int a,int b) { return dp[a%100000][a/100000]>dp[b%100000][b/100000]; } }; int dis[20][20]; int n,m; int bfs() { memset(dp,127,sizeof(dp)); priority_queue,cmp> q; int i,j; int t1,t2,t3,t4; q.push(1); dp[1][0]=0; while(!q.empty()) { t1=q.top(); q.pop(); t2=t1/100000; t1%=100000; if(t1==(1<dp[t1][t2]+dis[t2][i]) { dp[t1|(1<