题意是求多个串的lcs。 这也是道后缀自动机的模板题。对于任意一个字符串建后缀自动机,用其他串查询就行。对于后缀自动机的每个状态要额外记匹配到当前状态的最大长度。 和spoj1811的区别在于这道题不方便后缀数组做。当然,如果不嫌很多个串用奇怪的字符连起来麻烦、判断时常数极大的话,也可以试试。 #i ...
分类:
其他好文 时间:
2018-01-19 15:44:57
阅读次数:
163
后缀数组sa(x)表示排序后第x位在排序前的位置。 这个东西的求法有两种,一种是倍增,时间复杂度o(n log n)或o(n log2n),另一种是用不知道什么方法做到的o(n)。 至于第二种方法是什么,并不对劲的人并不知道,所以只说倍增。 考虑正常地比较两个字符串,都是从头比较到尾: 那么,如果把 ...
分类:
编程语言 时间:
2018-01-19 11:40:36
阅读次数:
160
题面 "传送门" Sol 这是一道阅读理解题,读了好久才明白意思。。。 首先可以想到处理出next数组,每次的位置i跳next跳到长度小于i的一半位置,然后继续跳到零统计此时跳的次数就是答案 那么暴力就是$O(n^2)$ 让我们一起膜拜yyb大佬的 "倍增跳next" 那么优化就是在求next的时候 ...
分类:
其他好文 时间:
2018-01-18 15:00:42
阅读次数:
122
题目大意 找一个环串的起点,使得从其开始遍历字典序最小 题解 建立后缀自动机,从根开始走length步,走到的点就是这个最小串的结尾,其step即表示它在串中的位置 step n + 1即为开始位置 C++ include include include include include define ...
分类:
其他好文 时间:
2018-01-17 00:34:00
阅读次数:
119
一道英语阅读理解,满满的都是套路,欺负我英文不好(自己去翻译吧,我就不写中文了) 原题链接 我们模拟一遍就好了,如果"!"把句子中没出现的字母排除,"."就排除句子里出现的。 注意答案是从已知那个字母开始统计的。 #include<bits/stdc++.h> using namespace std ...
分类:
其他好文 时间:
2018-01-17 00:22:40
阅读次数:
171
strlen() 函数返回字符串的长度(字符数) 代码: <?php echo strlen("Hello world!"); ?> <?php echo strlen("Hello world!"); ?> <?php echo strlen("Hello world!"); ?> <?php e ...
分类:
Web程序 时间:
2018-01-16 23:57:54
阅读次数:
349
#include <stdio.h>#include <stdlib.h>#include <string.h>char * strtolower(char * old){ char xx[1000]; int ii, length=0; length=strlen(old); for(ii=0; ...
分类:
编程语言 时间:
2018-01-13 01:20:36
阅读次数:
316
function mb_unserialize($serial_str) { $serial_str= preg_replace('!s:(\d+):"(.*?)";!se', "'s:'.strlen('$2').':\"$2\";'", $serial_str ); $serial_str= s... ...
分类:
Web程序 时间:
2018-01-12 11:23:02
阅读次数:
200
You are given a string S which consists of 250000 lowercase latin letters at most. We define F(x) as the maximal number of times that some string with ...
分类:
其他好文 时间:
2018-01-11 20:27:39
阅读次数:
155
来源:http://www.centoscn.com/python/2013/0807/1155.html ...
分类:
编程语言 时间:
2018-01-11 16:18:21
阅读次数:
238