Tree1 Tree #include using namespace std; typedef long long ll; const int MAX = 100001; int parent[MAX]; struct Tree { int root, size; vector child[MAX], edge[MAX]; Tree() { root = -1; size = 0; } Tree(int n) { root = -1; size = n; } void addEdge(int u, int v) { edge[u].push_back(v); edge[v].push_back(u); } void build(int id) { if (root == -1) root = id; for (int next : edge[id]) { if (!parent[next]) { pare.. 2020. 8. 6. 이전 1 다음