随笔分类 - 树 - prufer序列
摘要:非常好的一道题. 假设当前要求 $ans[x]$. 先令 $x$ 为根,然后发现对于子树 $y$ 来说,令 $g[y]$ 表示距离 $y$ 最近的叶子节点. 若 $g[y] \leqslant dis(x,y) $ 则 $y$ 子树的叶子中选一个就可以防止 $x$ 走到 $y$ 的子树中. 那么这个
阅读全文
摘要:好神仙的多项式啊! 需要用到:prufer序列,生成函数,多项式求逆,多项式取 ln,多项式 exp..... code: #include <cmath> #include <cstring> #include <algorithm> #include <cstdio> #include <str
阅读全文
摘要:直接套用 prufer 序列公式即可,但是要特判不合法的情况. code: #include <cstdio> #include <algorithm> #define ll long long #define N 200 #define setIO(s) freopen(s".in","r",st
阅读全文
摘要:根据prufer序列的结论: 一个无根树对应唯一一个 prufer 序列,一个 prufer 序列也唯一对应一个无根树. 一个点在 prufer 序列中的出现次数是 $deg_{i}$ 次. $n$ 个点完全图的生成树个数是 $n^{(n-2)}$ 个. code: #include <cstdio
阅读全文

浙公网安备 33010602011771号