树上启发式合并(静态链分治)模板题。
首先一个串能重排形成是回文串当且仅当其字符数量最多有一个为奇数。
所以我们对字符集状压,\(0\)表示偶,\(1\)表示奇。
记\(dis_u\)为\(1\)到\(u\)的路径上的字符集。
那么对于点对\(u,v\),其路径上的字符集为\(dis_u\oplus dis_v\)。
相关文章
- 04-02CF741D Arpa’s letter-marked tree and Mehrdad’s Dokhtar-kosh paths
- 04-02741D.Arpa’s letter-marked tree and Mehrdad’s Dokhtar-kosh paths(树上启发式合并+状压)
- 04-02CF741D Arpa’s letter-marked tree and Mehrdad’s Dokhtar-kosh paths 树上启发式合并(DSU ON TREE)
- 04-02CF741D Arpa’s letter-marked tree and Mehrdad’s Dokhtar-kosh paths
- 04-02[CF741D]Arpa's letter-marked tree and Mehrdad's Dokhtar-kosh paths
- 04-02CF741 D Arpa’s letter-marked tree and Mehrdad’s Dokhtar-kosh paths
- 04-02【DSU on tree】【CF741D】Arpa’s letter-marked tree and Mehrdad’s Dokhtar-kosh paths
- 04-02CF741D Arpa’s letter-marked tree and Mehrdad’s Dokhtar-kosh paths
- 04-02codeforces 741D Arpa’s letter-marked tree and Mehrdad’s Dokhtar-kosh paths
- 04-02CF 741D. Arpa’s letter-marked tree and Mehrdad’s Dokhtar-kosh paths [dsu on tree 类似点分治]