树形DP #include<cstdio> #include<algorithm> #define rep(i,x,y) for (int i=x; i<=y; i++) using namespace std; int cnt,last[300005],c[300005]; long long F[300005][2][3],G[2][3]; struct node{ int to,next,val; }e[600005]; void add(int a,int b,int…
Problem Description Coco has a tree, whose vertices are conveniently labeled by 1,2,…,n.There are m chain on the tree, Each chain has a certain weight. Coco would like to pick out some chains any two of which do not share common vertices.Find out t…