您好,欢迎来到六九路网。
搜索
您的当前位置:首页P5021 [NOIP2018 提高组] 赛道修建

P5021 [NOIP2018 提高组] 赛道修建

来源:六九路网

取max初始值一定要赋成-1

#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=100010;
int n,m,tot,head[N],f[N],g[N],ans=-1;
struct edge{int to,next,w;}e[N<<1];
int read()
{
	int x=0,f=1;
	char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
int l,r,mid; 
multiset<int>s;
multiset<int>::iterator it;
void add_edge(int u,int v,int w)
{
	e[++tot].to=v;
	e[tot].w=w;
	e[tot].next=head[u];
	head[u]=tot;
}
void dfs(int u,int fa)
{
	for(int i=head[u];i;i=e[i].next)
	{
		int v=e[i].to;
		if(fa==v) continue;
		dfs(v,u);
		f[u]+=f[v];
	}
	for(int i=head[u];i;i=e[i].next)
	{
		int v=e[i].to;
		if(fa=

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- 69lv.com 版权所有 湘ICP备2023021910号-1

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务