Loading

随笔分类 -  字符串

摘要:描述 传送门:我是传送门 A musical melody is represented as a sequence of N (1<=N<=20000)notes that are integers in the range 1..88, each representing a key on th 阅读全文
posted @ 2021-01-20 21:26 Yiduuannng 阅读(70) 评论(0) 推荐(0)
摘要:描述 注意,这一份后缀数组的代码并不能AC 传送门:我是传送门 Given two strings a and b we define ab to be their concatenation. For example, if a = “abc” and b = “def” then ab = “a 阅读全文
posted @ 2021-01-20 21:18 Yiduuannng 阅读(54) 评论(0) 推荐(0)
摘要:描述 传送门:我是传送门 小t非常感谢大家帮忙解决了他的上一个问题。然而病毒侵袭持续中。在小t的不懈努力下,他发现了网路中的“万恶之源”。这是一个庞大的病毒网站,他有着好多好多的病毒,但是这个网站包含的病毒很奇怪,这些病毒的特征码很短,而且只包含“英文大写字符”。当然小t好想好想为民除害,但是小t从 阅读全文
posted @ 2021-01-20 21:13 Yiduuannng 阅读(110) 评论(0) 推荐(0)
摘要:描述 传送门:我是传送门 CA loves strings, especially loves the palindrome strings. One day he gets a string, he wants to know how many palindromic substrings in 阅读全文
posted @ 2021-01-20 20:43 Yiduuannng 阅读(64) 评论(0) 推荐(0)
摘要:应用场景 1.求串S前缀font>0~i内本质不同回文串的个数(两个串长度不同或者长度相同且至少有一个字符不同便是本质不同) 2.求串S内每一个本质不同回文串出现的次数 3.求串S内回文串的个数(其实就是1和2结合起来) 4.求以下标i结尾的回文串的个数 参考资料: Palindromic Tree 阅读全文
posted @ 2021-01-20 20:40 Yiduuannng 阅读(64) 评论(0) 推荐(0)
摘要:描述 传送门:我是传送门 当太阳的光辉逐渐被月亮遮蔽,世界失去了光明,大地迎来最黑暗的时刻。。。。在这样的时刻,人们却异常兴奋——我们能在有生之年看到500年一遇的世界奇观,那是多么幸福的事儿啊~~但网路上总有那么些网站,开始借着民众的好奇心,打着介绍日食的旗号,大肆传播病毒。小t不幸成为受害者之一 阅读全文
posted @ 2021-01-20 20:35 Yiduuannng 阅读(90) 评论(0) 推荐(0)
摘要:应用场景 多模式匹配问题 多串匹配一个串 预定义 1 const int N = 1e6+100; 2 char s[N],m[N]; 3 struct node 4 { 5 int son[26]; 6 int fail; 7 int count; 8 }ac[N]; 9 int tot = 0; 阅读全文
posted @ 2021-01-20 20:34 Yiduuannng 阅读(59) 评论(0) 推荐(0)
摘要:描述 传送门:我是传送门 A prefix of a string is a substring starting at the beginning of the given string. The prefixes of “carbon” are: “c”, “ca”, “car”, “carb” 阅读全文
posted @ 2021-01-20 20:30 Yiduuannng 阅读(111) 评论(0) 推荐(0)
摘要:描述 传送门:我是传送门 Ignatius最近遇到一个难题,老师交给他很多单词(只有小写字母组成,不会有重复的单词出现),现在老师要他统计出以某个字符串为前缀的单词数量(单词本身也是自己的前缀). 输入 输入数据的第一部分是一张单词表,每行一个单词,单词的长度不超过10,它们代表的是老师交给Igna 阅读全文
posted @ 2021-01-20 18:20 Yiduuannng 阅读(64) 评论(0) 推荐(0)
摘要:字典树 预定义 1 const int N = 1e6+10; 2 int tot = 1; 3 struct node 4 { 5 int son[26]; 6 int cnt; // 特殊标记 7 bool have; 8 node() 9 { 10 memset(son,0,sizeof so 阅读全文
posted @ 2021-01-20 18:16 Yiduuannng 阅读(88) 评论(0) 推荐(0)
摘要:描述 传送门:我是传送门 John is a manager of a CPU chip factory, the factory produces lots of chips everyday. To manage large amounts of products, every processo 阅读全文
posted @ 2021-01-20 18:14 Yiduuannng 阅读(55) 评论(0) 推荐(0)
摘要:描述 传送门:我是传送门 最经,skyzhong得到了一本好厉害的字典,这个字典里整整有n个单词(1<=n<=200000) 现在skyzhong需要在字典里查询以某一段字母开头的单词 如:skyzhong想查询a 那么只要是a开头的单词就可以了 skyzhong只想知道里面有没有这一个单词(因为没 阅读全文
posted @ 2021-01-20 18:12 Yiduuannng 阅读(132) 评论(0) 推荐(0)
摘要:描述 参考资料: Manacher算法 - 经典算法与数据结构 - SegmentFault 思否 hdu3068之manacher算法+详解 代码 头部 1 #include <cstring> 2 #include <algorithm> 3 4 const int N = 1e5+10; 5 阅读全文
posted @ 2021-01-20 18:10 Yiduuannng 阅读(51) 评论(0) 推荐(0)
摘要:概述 参考资料: 字符串匹配—最大最小表示法 最小表示法和最大表示法模板 最小(大)表示法是字符串问题中不同于匹配与失配的另一种O(n)的算法,它主要解决的是字符串的同构问题。将单个字符串循环左移右移算作该串的同构,最小(大)表示法能够在O(n)时间内求出这个串的所有同构串中的字典序最小的串的起始位 阅读全文
posted @ 2021-01-20 18:08 Yiduuannng 阅读(125) 评论(0) 推荐(0)
摘要:概述 参考资料: 刘雅琼PPT讲解kuangbin的博客 给出模板串A和子串B,长度分别为lenAlenA和lenBlenB,要求在线性时间内,对于每个A[i]A[i](0<=i<lenA)(0<=i<lenA) 求出A[i..lenA−1]A[i..lenA−1] 与B的最长公共前缀长度,记为ex 阅读全文
posted @ 2021-01-20 17:57 Yiduuannng 阅读(86) 评论(0) 推荐(0)
摘要:概述 模板出自kuangbin的博客 典型应用: 给你两个字符串,寻找其中一个字符串是否包含另一个字符串,如果包含,返回包含的起始位置。 (1) 头文件 1 #include <bits/stdc++.h> 2 using namespace std; 3 const int N = 1e5+10; 阅读全文
posted @ 2021-01-20 17:56 Yiduuannng 阅读(74) 评论(0) 推荐(0)