摘要:
思路:直接先求一下最小生成树,然后用树形dp来求最优值。也就是两遍dfs。#include#include#include#include#include#define Maxn 2010using namespace std;struct Edge{ int u,v; double c; int operator Max[u]){ lMax[u]=Max[u]; Max[u]=Max[v]; road[u]=v; } else if(Max[v]>lMax[u]){ ... 阅读全文
摘要:
思路:将边从大到小排序,判断向哪边连,能使总和最大。#include#include#include#include#include#include#include#include#include#include#include#define Maxn 200010#define Maxm 200010#define LL __int64#define Abs(x) ((x)>0?(x):(-x))#define lson(x) (xtemp.val; }}p[Maxn];int Set[Maxn];LL sum[Maxn],num[Maxn];int Find(int x){ i... 阅读全文