本文共 648 字,大约阅读时间需要 2 分钟。
#includeusing namespace std;const int maxn=5e3+1;const int INF=1e6;int n,m,num[maxn],size[maxn],ans[maxn],father[maxn],deep[maxn];struct cxk{ int v,id;};struct node{ int u,v,w;}s[maxn];vector g[maxn];bool cmp(const node &a,const node &b){ return a.w>b.w;}void dfs(int u,int fa){ father[u]=fa; deep[u]=deep[fa]+1; for(auto to:g[u]) { if(to.v==fa) continue; dfs(to.v,u); size[to.v]=to.id; } num[u]=INF;}bool check(int x,int y,int k){ int minn=INF; if(deep[x]
转载地址:http://woewz.baihongyu.com/