后缀自动机
永夜莫明
菜是原罪
展开
-
string(SAM+PAM)
https://ac.nowcoder.com/acm/contest/884/I?&headNav=acm 题意:求string串有多少个本质不同的子串,且这些子串之间两两不存在 a==rev(a),及不存在长度1以上的回文串 题解:要算string 和 rev(string)的所有子串,对string 和rev(string)建立广义后缀自动机,则理论上所有子串增加了一倍,但实际...转载 2019-07-29 00:13:24 · 228 阅读 · 2 评论 -
Longest Common Substring (SAM,求两个字符串的最长公共子串的长度)
A string is finite sequence of characters over a non-empty finite set Σ. In this problem, Σ is the set of lowercase letters. Substring, also called factor, is a consecutive sequence of characters oc...原创 2019-07-29 16:49:02 · 350 阅读 · 0 评论 -
String and Times(SAM)
https://nanti.jisuanke.com/t/A2018 Now you have a string consists of uppercase letters, two integersAAandBB. We call a substring wonderful substring when the times it appears in that string is bet...原创 2019-08-03 02:43:28 · 186 阅读 · 0 评论 -
string string string (SAM——求出现k次的字符串种数)
https://cn.vjudge.net/problem/HDU-6194 Uncle Mao is a wonderful ACMER. One day he met an easy problem, but Uncle Mao was so lazy that he left the problem to you. I hope you can give him a solution. ...原创 2019-08-06 20:35:01 · 315 阅读 · 0 评论 -
重复旋律(SAM——求出现次数>=K的子串的最大长度)
https://cn.vjudge.net/problem/HihoCoder-1403 描述 小Hi平时的一大兴趣爱好就是演奏钢琴。我们知道一个音乐旋律被表示为长度为 N 的数构成的数列。 小Hi在练习过很多曲子以后发现很多作品自身包含一样的旋律。旋律是一段连续的数列,相似的旋律在原数列可重叠。比如在1 2 3 2 3 2 1 中 2 3 2 出现了两次。 小Hi想知道一段旋律中出现次数...原创 2019-08-06 21:55:02 · 376 阅读 · 0 评论 -
Substrings(SAM——求长度为i的子串最大的出现次数)
https://cn.vjudge.net/problem/SPOJ-NSUBSTR You are given a string S which consists of 250000 lowercase latin letters at most. We define F(x) as the maximal number of times that some string with lengt...原创 2019-08-07 00:30:54 · 499 阅读 · 0 评论 -
Lexicographical Substring Search(SAM——求字典序第k小的子串)
Little Daniel loves to play with strings! He always finds different ways to have fun with strings! Knowing that, his friend Kinan decided to test his skills so he gave him a stringSand asked himQq...原创 2019-08-07 02:42:56 · 451 阅读 · 0 评论 -
SAM模板整理
SAM填坑告一段落了(为什么代码格式变了,高亮也乱七八糟的) https://paste.ubuntu.com/p/TTht5PVZww/ #include<bits/stdc++.h> using namespace std; typedef long long ll; const int maxn=1e5+10;//字符串长度 const int maxc=26; char...原创 2020-05-18 19:31:21 · 347 阅读 · 0 评论