
后缀自动机
ORZZROORZZRO
川大的小可爱
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
K-th occurrence (后缀自动机上合并权值线段树+树上倍增)
AC代码:#include<iostream>#include<cstring>#include<vector>using namespace std;const int MAXN = 1e5 + 5;int N, L, R, K, Q;char S[MAXN];int u[MAXN];//1...rint EndPosToTree[2 *...原创 2020-01-30 18:17:09 · 384 阅读 · 0 评论 -
Longest Common Substring(最长公共子串)
SP1811题目描述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 ch...原创 2020-01-26 20:21:07 · 514 阅读 · 0 评论 -
数字子串的和 str2int
UVA1673这道题可以用广义后缀自动机,不过陈锋老师给我们讲了一个巧妙地方法,使得这道题可以用普通的后缀自动机做。题目大意:给出NNN个完全由数字组成的字符串。计算将这个NNN的字符串的所有子串转换为整数后先去重再求和的结果,输出其模2012的余数。也就是求其子串的所有本质不同的字符串的和。预处理:首先,我们可以将NNN个字符串拼接起来,拼接的部位可以用一个特殊的分隔符隔开。比如这里...原创 2020-01-26 16:59:47 · 440 阅读 · 0 评论 -
Substrings
SP8222You 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 length x appears in S. For example for st...原创 2020-01-26 15:54:15 · 197 阅读 · 0 评论 -
Reincarnation
HDU4622Now you are back,and have a task to do:Given you a string s consist of lower-case English letters only,denote f(s) as the number of distinct sub-string of s.And you have some query,each tim...原创 2020-01-26 15:16:09 · 183 阅读 · 0 评论 -
New Distinct Substrings
SP705Given a string, we need to find the total number of its distinct substrings.InputTTT- number of test cases.T<=20T<=20T<=20; Each test case consists of one string, whose length is <...原创 2020-01-26 15:00:18 · 272 阅读 · 0 评论 -
Glass Beads
UVA719将循环串SSS展开成两倍大小:S+SS+SS+S,这样线性处理就可以处理所有循环的情况了。对S+SS+SS+S建立一个后缀自动机,让后从初始状态开始走,每次选择字典序最小的道路,走NNN步就得到一个字典序最小的原串了。假设最后走到ppp,那么此时首字符下标即为len(p)−N+1len(p)-N+1len(p)−N+1,即从首字符的位置走了NNN步到ppp。AC代码:#incl...原创 2020-01-26 14:43:20 · 555 阅读 · 0 评论 -
转载-后缀自动机讲解
https://www.cnblogs.com/zjp-shadow/p/9218214.html#autoid-4-0-0作者:zjp_shadow转载 2020-01-26 14:28:32 · 207 阅读 · 0 评论