• 2024-08-29P10013 [集训队互测 2023] Tree Topological Order Counting
    Description给定一颗\(n\)个点的有根树,\(1\)是根,记\(u\)的父亲是\(fa_u\)。另给出一长度为\(n\)的权值序列\(b\)。称一个长度为\(n\)的排列\(a\)为这颗树的合法拓扑序,当且仅当\(\forall2\leu\len,a_u>a_{fa_u}\)。对每个点\(u\),定义\(f(u)\)为,在所有这