首页 > TAG信息列表 > Palindromeness

Codechef Palindromeness 和 SHOI2011 双倍回文

Palindromeness Let us define the palindromeness of a string in the following way: If the string is not a palindrome, its' palindromeness is zero. The palindromeness of an one-letter string is 1. The palindromness of a string S of the length greater

【CodeChef PALPROB】Palindromeness(回文自动机)

传送门 题解: 建立回文自动机,维护每个点right集合大小。 然后维护halfhalfhalf指针,表示failfailfail树上第一个长度小于等于自己的一半的回文后缀。 在建立的时候暴力跳祖先的half更新答案,复杂度还是由均摊分析O(∣S∣)O(|S|)O(∣S∣) 代码: #include<bits/stdc++.h> #defin

Codechef PALPROB Palindromeness 回文树

传送门——Vjudge 构建出回文树,那么我们需要对于回文树的每一个节点求出它在原串中的出现次数和前\(\frac{len}{2}\)个字符构成的串 前者可以直接在fail树上传递endpos标记,后者可以倍增。但是后者还有一种复杂度\(O(?)\)的做法跑得非常快: 对于每一个点维护\(half_x\)表示点\(x\)对