#include<cstdio> #include<iostream> #define M 1000009 #define N 250009 #define ll long long #define inf 1000000000000000000LL #include<algorithm> using namespace std; ],deep[N],m,h[N],dfn[N],TI,cnt1,zhan[N],tot,head1[N]; int next1[M],u1[…
http://www.lydsy.com/JudgeOnline/problem.php?id=2286 题意:n个点的边加权树,m个询问,每次询问给出的k个点与结点1分离的最小代价.(n<=250000, sum{ki}<=500000) #include <bits/stdc++.h> using namespace std; typedef long long ll; const int N=250005, oo=0x7f7f7f7f; int dep[N], FF[N],…
http://www.lydsy.com/JudgeOnline/problem.php?id=2286 虚树上树形DP #include<cmath> #include<cstdio> #include<cstring> #include<iostream> #include<algorithm> using namespace std; #define N 250001 typedef long long LL; int tot; int n…