题解:AT_arc201_c [ARC201C] Prefix Covering

· · 题解

trie 树上 dp。考虑插入一个数的时候只会修改路径上的,那么时间是 \mathcal{O}(\sum |s_i|)。

设 dp_u 为“表示完”u 子树的方案数。那么: