题意:找一个出现了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…
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…
Life Forms Problem's Link Mean: 给你n个串,让你找出出现次数大于n/2的最长公共子串.如果有多个,按字典序排列输出. analyse: 经典题. 直接二分判断答案. 判断答案p时,我们扫一遍height数组,如果height[i]<p时开辟一个新段. 判断时用set存储所在串编号,不仅起到去重的作用,而且也起到统计段长的作用. 也可以直接用字符串hash来做,也是先二分,然后O(n)判断,时间复杂度和后缀数组一样. Time complexity: O(N*log…