#include #include #include #include #include #define REP(i,n) for(int i=0;i<(int)n;++i) #define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i) #define ALL(c) (c).begin(), (c).end() using namespace std; typedef int Weight; typedef vector Array; typedef vector Matrix; const int M = 20; Weight best[1< &path) { if (!S) return; buildPath(S^(1< &path) { int n=w.size(); int N = 1 << n; REP(S,N) REP(i,n) best[S][i] = 0; REP(S,N) REP(j,n) if (!(S&(1< path; printf("%d\n",shortestHamiltonPath(m,path)); }