Live2d Test Env
摘要: Alice get a string S. She thinks palindrome string is interesting. Now she wanna know how many three tuple (i,j,k) satisfy 1≤i≤j<k≤length(S) , S[i..j] 阅读全文
posted @ 2019-02-08 12:34 nimphy 阅读(346) 评论(0) 推荐(0) 编辑
摘要: Sample Input 6 1 a 1 b 2 a 2 c 3 4 8 1 a 2 a 2 a 1 a 3 1 b 3 4 Sample Output 4 5 4 5 11 题意:多组输入,开始字符串为空,支持4中操作: 1,在字符串首加字符; 2,在字符串尾加字符; 3,查询字符串不同本质的回文 阅读全文
posted @ 2019-02-08 11:12 nimphy 阅读(363) 评论(0) 推荐(0) 编辑
摘要: Sample Input aca aaaa Sample Output 3 15 题意: 多组输入,每次给定字符串S(|S|<1e5),求多少对不相交的回文串。 思路:可以用回文树求出以每个位置结尾的回文串数,那么累加得到前缀和; 倒着再做一遍得到每个位置为开头的回文串数,乘正向求出的前缀和即可。 阅读全文
posted @ 2019-02-08 10:11 nimphy 阅读(323) 评论(0) 推荐(0) 编辑