D. 旅游景点 Tourist Attractions 状压DP
题目描述
输入格式
输出格式
样例
样例输入
8 15 4
1 2 3
1 3 4
1 4 4
1 6 2
1 7 3
2 3 6
2 4 2
2 5 2
3 4 3
3 6 3
3 8 6
4 5 2
4 8 6
5 7 4
5 8 6
3
2 3
3 4
3 5
样例输出
19
#include<bits/stdc++.h>
#define re register int
#define N 200100
#define M 400010
#define INF 10000000
using namespace std;
int n,m,k;
int tot,ans;
int head[N];
int dis[31][N];
int fa[31];
int f[1<<21][22];
bool vis[N];
struct TU
{
int s,u;
friend bool operator < (TU x,TU y)
{
return x.u>y.u;
}
}t;
priority_queue<TU> Q;
struct CUN
{
int fr,to,w,next;
}use[M<<4];
void add(int x,int y,int z)
{
use[++tot].fr=x;
use[tot].to=y;
use[tot].w=z;
use[tot].next=head[x];
head[x]=tot;
}
void dj(int st)
{
memset(vis,0,sizeof(vis));
while(!Q.empty())
Q.pop();
dis[st][st]=0;
t.s=st;
t.u=0;
Q.push(t);
int x,y,p;
while(!Q.empty())
{
x=Q