Power Strings Time Limit: 3000MS Memory Limit: 65536K Total Submissions: 41252 Accepted: 17152 Description Given two strings a and b we define a*b to be their concatenation. For example, if a = "abc" and b = "def" then a*b = "…
看的<后缀数组——处理字符串的有力工具>这篇论文,在那里这道题是用后缀数组实现的,复杂度为$O(nlogn)$,很明显长度为$2×10^6$的数据会TLE,所以必需得用复杂度为$O(n)$的KMP算法.第一次写KMP,我好弱啊QAQ KMP: #include<cstdio> #include<cstring> #include<algorithm> using namespace std; const int N = 2000003; char s[N];…
Power of Cryptography Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 18258 Accepted: 9208 Description Current work in cryptography involves (among other things) large prime numbers and computing powers of numbers among these primes. W…
描述 Given two strings a and b we define a*b to be their concatenation. For example, if a = "abc" and b = "def" then a*b = "abcdef". If we think of concatenation as multiplication, exponentiation by a non-negative integer is de…
Surprising Strings Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 6258 Accepted: 4072 Description The D-pairs of a string of letters are the ordered pairs of letters that are distance D from each other. A string is D-unique if all of…