随笔分类 - 技巧--无根树转有根树
摘要:既然是“暴力杯”,那么就采取暴力的解法。 我们从下往上递归去找点就好了 dfs无根树转有根树,递归找最优。注意开LL 1 #include <iostream> 2 #include <algorithm> 3 #include <string> 4 #include <string.h> 5 #i
阅读全文
摘要: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
阅读全文

浙公网安备 33010602011771号