为了体现我29买的typora的价值,本文用typora编辑
题目链接
思路
就是裸的(但不是神的)DSU on tree
但是主教练给了个思考方向:bfs序???很合理,深深感觉思路被局限了。
蒟蒻只会看题解,尽管这是一道简单题(我不会dsu)
代码
#include<bits/stdc++.h> using namespace std; const int maxn=1e5+10; #define pii pair<int,int> vector<pii>q[maxn];//存储问题 struct Node{ string name; int fa,num; }node[maxn]; struct Edge{