摘要:
这题主要是要将两个串的比较进行优化,不能够每次都从起始位置进行匹配。这里用到了线段树进行优化,将每段区间的hash值进行更新和维护,通过找某一点的有连续段最长相同串即可。代码如下:#include <cstdlib>#include <cstring>#include <cstdio>#include <algorithm>#define MOD 100000003#define T 29LLusing namespace std;typedef unsigned int Int64;// 这里建立棵线段树记录某一短区间的hash值 char s 阅读全文
posted @ 2012-08-04 22:17
沐阳
阅读(374)
评论(0)
推荐(0)