随笔分类 - 字符串
题解 luoguP5466 【[PKUSC2018]神仙的游戏】
摘要:显然要是没有限制那就全都是1对吧, 所以考虑这些0, 1到底限制了啥。 首先看到border, 容易想到当年写kmp求最短回文子串的那题。因为kmp的next数组实际上就是最长border。我们也在那题积累一个结论, 就是对于原来的串一个长度为k的border,
PAM
摘要:struct PAM { int ch[N][26], fail[N], len[N]; int tot, las; PAM() { len[0] = 0; len[1] = -1; fail[0] = 1; tot = 1; las = 0; } inline int gtfail(int x,
SAM模板
摘要:#include <cstdio> #include <cstring> #include <algorithm> using namespace std; #define R register #define LL long long const int inf = 0x3f3f3f3f; con