Dr. Ellie Arroway has established contact with an extraterrestrial civilization. However, all efforts to decode their messages have failed so far because, as luck would have it, they have stumbled upon a race of stuttering aliens! Her team has found…
思路 可以二分答案+哈希 判断有没有那个长为L的串出现至少m次即可 代码 #include <cstdio> #include <cstring> #include <algorithm> #include <map> using namespace std; int n,m; const int base = 131; unsigned long long hashx[80000],power[80000]; int ans=0,lastans=0; ch…
题意:找一个出现了m次的最长子串,以及这时的最右的位置. hash的话代码还是比较好写的,,但是时间比SA多很多.. #include <stdio.h> #include <algorithm> #include <string.h> using namespace std; + ; typedef long long ll; ; ; char s[N]; int m,len,pw[N]; int H[N],pos; struct node { int id,hash…
题目传送门 题意:训练指南P225 分析:二分寻找长度,用hash值来比较长度为L的字串是否相等. #include <bits/stdc++.h> using namespace std; typedef unsigned long long ull; const int N = 4e4 + 5; const int x = 123; ull H[N], _hash[N], xp[N]; int rk[N]; char str[N]; int m; void get_hash(char *s…