随笔分类 -  技巧--无根树转有根树

摘要:既然是“暴力杯”,那么就采取暴力的解法。 我们从下往上递归去找点就好了 dfs无根树转有根树,递归找最优。注意开LL 1 #include <iostream> 2 #include <algorithm> 3 #include <string> 4 #include <string.h> 5 #i 阅读全文
posted @ 2020-01-22 13:11 _Ackerman 阅读(521) 评论(0) 推荐(0)
摘要:std::vector<int> tree[maxn]; int fa[maxn]; void dfs(int u,int father) { int len = tree[u].size(); for (int i = 0;i < len;i++) { int v = tree[u][i]; if 阅读全文
posted @ 2020-01-22 12:56 _Ackerman 阅读(235) 评论(0) 推荐(0)