题目大意: 给出总长度不超过1E+5的不重复字符串集,给每个字符串选一个前缀使得可以区分它. 题目分析: KAN出的DIV2难度一般不高,想升Ranting的可以试试. 简单的树上启发式合并,建出Trie树,一开始每个字符串用自己表示,每次向上合并的时候选出堆中最大元素变成当前位置,特判一下有end的地方即可. 证明也很简单,我们考虑一个根没被选的子树,若我们要使得这个子树的代价最小,那么我们一定要选择一个位置放到根上来,不难发现选择深度最大的点是会最小的.由于树的子结构的关系,这样向上归纳也是…