
KMP
ityanger
大道至简,知易行难
-
原创 POJ - Oulipo(KMP)
题目链接:http://poj.org/problem?id=3461Time Limit:1000MSMemory Limit:65536KDescriptionThe French author Georges Perec (1936–1982) once wrote a book, La disparition, without the letter'e'. He was a...2018-10-13 18:27:492258
0
-
原创 AcWing - KMP字符串(KMP)
题目链接:https://www.acwing.com/problem/content/description/833/时/空限制:1s / 64MB题目描述给定一个模式串S,以及一个模板串P,所有字符串中只包含大小写英文字母以及阿拉伯数字。模板串P在模式串S中多次作为子串出现。求出模板串P在模式串S中所有出现的位置的起始下标。输入格式第一行输入整数N,表示字符串P的长度...2019-08-22 08:51:512101
0
-
原创 LightOJ - Making Huge Palindromes(KMP&回文)
题目链接:http://lightoj.com/volume_showproblem.php?problem=1258Time Limit:1 second(s)Memory Limit:32 MBProblem DescriptionA string is said to be a palindrome if it remains same when read backwards....2019-08-12 09:23:422173
0
-
原创 POJ - Seek the Name, Seek the Fame(KMP之next数组的简单应用)
题目链接:http://poj.org/problem?id=2752Time Limit:2000MSMemory Limit:65536KDescriptionThe little cat is so famous, that many couples tramp over hill and dale to Byteland, and asked the little cat t...2019-07-31 10:07:002191
0
-
原创 HDU - A + B for you again(KMP)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1867Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Problem DescriptionGenerally speaking, there are a lot of problem...2019-07-31 09:55:592119
0
-
原创 HDU - Number Sequence(KMP)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1711Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Problem DescriptionGiven two sequences of numbers : a[1], a[2], ...2019-07-30 18:53:301997
0
-
原创 HDU - 亲和串(KMP)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2203Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Problem Description人随着岁数的增长是越大越聪明还是越大越笨,这是一个值得全世界科学家思考的问题,同样的问题Ed...2019-07-30 18:49:032171
0
-
原创 HDU - Best Reward(KMP)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3613Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Problem DescriptionAfter an uphill battle, General Li won a great...2019-07-30 18:44:432118
0
-
原创 HDU - Theme Section(KMP)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4763Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Problem DescriptionIt's time for music! A lot of popular musician...2019-07-30 18:35:052189
0
-
原创 HDU - Cyclic Nacklace(KMP)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3746Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Problem DescriptionCC always becomes very depressed at the end of...2019-07-30 18:27:132166
0
-
原创 HDU - Simpsons’ Hidden Talents(KMP)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2594Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Problem DescriptionHomer: Marge, I just figured out a way to disc...2019-07-30 18:07:302168
0
-
原创 POJ - Period(KMP)
题目链接:http://poj.org/problem?id=1961Time Limit:3000MSMemory Limit:30000KDescriptionFor each prefix of a given string S with N characters (each character has an ASCII code between 97 and 126, inc...2019-07-30 17:59:532232
0
-
原创 牛客网 - [牛客OI周赛7-普及组]救救企鹅(KMP)
题目链接:https://ac.nowcoder.com/acm/contest/372/C时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 262144K,其他语言524288K64bit IO Format: %lld题目描述另一天,一只可爱的围着围巾的肥企鹅在路上摇摇晃晃地走着,遇上了迎面走来的打着饱嗝的PM6。小企鹅预感不妙,这不就是最近有名的恶人PM6么!吓得立...2019-04-17 00:34:172179
0
-
原创 KMP算法总结
KMP算法总结KMP算法关键是利用匹配失败后的信息,尽量减少模式串与主串的匹配次数以达到快速匹配的目的。具体实现就是实现一个next()函数,函数本身包含了模式串的局部匹配信息。时间复杂度O(m+n)。KMP算法的关键在于求算next[]数组的值,即求算A串的最长后缀与B串的前缀相同的长度,具体如下:1. 令k代表B串开头所在的序号,j代表A串开头所在的序号,起始的时候j=1,k=0。...2018-10-24 13:53:532168
0
-
原创 2019ICPC亚洲区域赛徐州网络赛
Problem B so easy题目链接:https://nanti.jisuanke.com/t/41384题意: 有两种操作:[1, x]表示将x这个点标记,[2, x]表示查询x后面第一个未被标记的数。思路: q的值比较小,所以解题应该从q入手,用并查集模拟实现一个链表,用map模拟并查集。当标记一个点x时,令x的父亲等于x+1的父亲,查询时直接输出x的父亲即可。Accepted ...2019-09-08 23:38:152279
0