ZJOI2018树--等价类相关计算
ZJOI2018 树
- 节点 1 作为树的根。
- 对于 \(i \in [2, n]\) ,独立地从 \([1, i)\) 中等概率随机选取一个节点作为 \(i\) 的父亲。
通过上面的方法独立的随机生成 \(k\) 棵 \(n\) 个节点的有根树 \(T_1\) 至 \(T_k\) ,他们两两同构的概率是多少。
denote \(s(t)\) the ways assign number to a tree
Define a shift operator \(D_c\) by
we want to know
(now the variable \(t\) always means a tree with size \(|t|\))
we have a equation
here \(f_{k,i}\) means the i-th coefficient of
so it can be solved by newton iteration or other techniques in \(O(n^2)\)
enum comb vol2 exercise 5.12
Let \(f(n)\) be the number of pairs \((u,v)\) of [n] permutations satisfying \(u^2=v^2\) find egf. of \(f\)
in fact the answer is \(\sum_i p_ix^i\) where \(p_i\) is integer partition , but I do not know how to do that.
but these kind of problem that enumerate information about equivalence class is extremely similar.
when squaring a cycle , it will remain unchanged when it is odd, and split into two when it is odd, so
for odd
\(p^k\) means find a place to link two cycle.
for even
multiply to function gives the answer, though the computation is slow.