思路:我们选几个点走,就用二进制枚举所有可能的情况1表示走过0表示没有走过,我们用dp[st][i]表示当前状态为st且最后到的点i的最短距离,那么可以发现他的当前状态st是由st‘来的st’必定比st少一个1,那么所以符合条件的dp[st][i]=dp[st’][j]+dis[j][i]转移过来,dis是j到i的最短距离,通过弗洛伊德算法求出来即可,然后在找出符合条件的状态进行转移。当st’i位置比st少个1时那么他转移的状态就是st’+(1<<(i-1))==st(目标状态)
#pragma GCC optimize(2)
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <set>
#include<iostream>
#include<vector>
#include<queue>
#include<map>
#include<stack>
#include<iomanip>
#include<cstring>
#include<time.h>
using namespace std;
typedef long long ll;
#define SIS std::ios::sync_with_stdio(false)
#define space putchar(' ')
#define enter putchar('\n')
#define lson root<<1
#define rson root<<1|1
typedef pair<int,int> PII;
const int mod=1e9+7;
const int N=2e6+10;
const int M=1e3+10;
const int inf=0x3f3f3f3f;
const int maxx=2e5+7;
const double eps=1e-6;
int gcd(int a,int b)
{
return b==0