上一页 1 2 3 4 5 6 7 ··· 12 下一页
摘要: 题意 给一个循环串,从某个点开始会得到一个字典序最小的串,从某个点开始会得到一个字典序最大的串,求这两个点的下标,以及其出现的次数。 "传送门" 思路 最小/大表示法求下标,kmp求出现次数。 "最小/大表示法" Code cpp include include using namespace st 阅读全文
posted @ 2019-09-13 14:44 Acerkoo 阅读(149) 评论(0) 推荐(0) 编辑
摘要: 题意 给定一个长度为 $n$ 的字符串,有 $q$ 次询问,每次询问求字符串的 $[l, r]$ 所形成的子串第 $k$ 次出现时的位置。 "传送门" 思路 $[l, r]$ 形成的子串,它是一些后缀的前缀,并且这些前缀在后缀数组中的rk是相邻的,因此,对于$[l, r]$ 我们可以通过 rmq/l 阅读全文
posted @ 2019-08-25 22:26 Acerkoo 阅读(143) 评论(0) 推荐(0) 编辑
摘要: 题意 后缀数组板子题 "传送门" Code cpp include using namespace std; const int maxn = 1e6+10; int n; char str[maxn]; struct SuffixArray { int x[maxn], y[maxn], c[ma 阅读全文
posted @ 2019-08-24 22:24 Acerkoo 阅读(108) 评论(0) 推荐(0) 编辑
摘要: 题意 给定n个模式串,求目标串中出现了多少个模式串。 "传送门" 思路 AC自动机模版题。 Code cpp include using namespace std; const int maxn = 1e6+10; struct Ac { int tr[maxn][26], fail[maxn], 阅读全文
posted @ 2019-08-22 23:15 Acerkoo 阅读(108) 评论(0) 推荐(0) 编辑
摘要: 题意 有一个大小为 $n ,(n \leq 3e5)$ 的序列,序列中的每一个数 $a_i$ 满足$1 \leq a_i \leq n$, 现定义 good subarray:对于一段区间$a_l, a_{l+1}, \dots, a_r$,满足区间内无重复元素并且 $\max\{a_l, a_{l 阅读全文
posted @ 2019-08-22 23:07 Acerkoo 阅读(190) 评论(0) 推荐(0) 编辑
摘要: 题意 给出大小为 $n$ 的字符串集合,给定字符串 $t$ ,求拆分 $t$ 的方案数,要求串 $t$ 拆分后每一个串都要是集合中的某个串。 _答案取模1e9+7_ 思路 对于一个串 $t$ 的第i个位置,如果他是某个串的结尾, 并且这个串之前的串也是个合法串,那么可进行dp转移,可用ac自动机的f 阅读全文
posted @ 2019-08-21 00:54 Acerkoo 阅读(204) 评论(0) 推荐(0) 编辑
摘要: 题意 给定一个串,求各长度下,本质不同的回文串并且回文串的左右两个字串也是回文串的数量。 "传送门" 思路 题意比较绕,理顺下来就是在回文树的每个节点,求其节点对应回文串的一半是否也是回文串,如果是,则其对该节点的长度产生贡献, 判断其回文串的一半是否也为回文串可以用马拉车或者哈希,哈希相对好写一点 阅读全文
posted @ 2019-08-20 10:58 Acerkoo 阅读(170) 评论(0) 推荐(0) 编辑
摘要: 链接:https://ac.nowcoder.com/acm/contest/888/A来源:牛客网 题目描述 Gromah and LZR entered the great tomb, the first thing they see is a matrix of size n×mn\times 阅读全文
posted @ 2019-08-11 12:57 Acerkoo 阅读(192) 评论(0) 推荐(0) 编辑
摘要: 题意 对于一个非负整数 i, 当 $i + (i+1) + (i+2)$ 计算过程中不产生进位时,称i满足条件, 求 小于n的 i 的个数。 "传送门" 思路 数位dp。 Code cpp include using namespace std; typedef long long ll; ll d 阅读全文
posted @ 2019-08-09 00:01 Acerkoo 阅读(130) 评论(0) 推荐(0) 编辑
摘要: 题意 AC自动机模版题。 "传送门" Code cpp include using namespace std; const int maxn = 1e6+10; int fail[maxn], e[maxn], tree[maxn][26], tot; void insert(char t) { 阅读全文
posted @ 2019-08-08 23:43 Acerkoo 阅读(109) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 ··· 12 下一页