poj3294】的更多相关文章

Life Forms Description You may have wondered why most extraterrestrial life forms resemble humans, differing by superficial traits such as height, colour, wrinkles, ears, eyebrows and the like. A few bear no human resemblance; these typically have ge…
http://poj.org/problem?id=3294 (题目链接) 题意 给定 n 个字符串,求出现在不小于 k 个字符串中的最长子串. Solution 后缀数组论文题.. 将 n 个字符串连起来,中间用不相同的且没有出现在字符串中的字符隔开,求后缀数组.然后二分答案,将后缀分成若干组,判断每组的后缀是否出现在不小于 k 个的原串中.这个做法的时间复杂度为 O(nlogn). 要求字典序从小到大排序的多组解,同样是利用rank进行排序即可. 细节 strlen害死人→_→,好像默认的A…
题目链接:https://vjudge.net/problem/POJ-3294 Life Forms Time Limit: 5000MS   Memory Limit: 65536K Total Submissions: 16905   Accepted: 4970 Description You may have wondered why most extraterrestrial life forms resemble humans, differing by superficial t…
题意: n<=100 len[i]<=1000 思路:这是一道论文题 ..]of longint; ch:..]of ansistring; n,n1,l,r,mid,last,i,j,m,len:longint; procedure swap(var x,y:longint); var t:longint; begin t:=x; x:=y; y:=t; end; function cmp(a,b,l:longint):boolean; begin exit((y[a]=y[b])and(y…
Life Forms Time Limit: 5000MS   Memory Limit: 65536K Total Submissions: 13063   Accepted: 3670 Description You may have wondered why most extraterrestrial life forms resemble humans, differing by superficial traits such as height, colour, wrinkles, e…
引用罗穗骞论文中的话: 将n 个字符串连起来,中间用不相同的且没有出现在字符串中的字符隔开,求后缀数组.然后二分答案,用和例3 同样的方法将后缀分成若干组,判断每组的后缀是否出现在不小于k 个的原串中.这个做法的时间复杂度为O(nlogn). #include<cstdio> #include<iostream> #include<algorithm> #include<vector> #include<cstring> #include<…
首先后缀数组预处理然后二分答案len很显然,然后考虑怎么判定我们用左右指针顺着名次扫描一下,初始左右指针为1根据LCP(i,j)=min(height[rank[i]+1]~height[rank[j]]) 设rank[i]<rank[j]移动右指针扫描得到一组后缀[i,j]之间LCP>=len,h[j+1]<len然后判断一下这组后缀是否有超过半数的原串,如果满足则记录然后左右指针都从j+1开始由于每个后缀最多被扫描一次判断一次,所以必然O(n)注意多个串相连接的时候要用不同的字符作为…
[题目链接] http://poj.org/problem?id=3294 [题意] 多个字符串求出现超过R次的最长公共子串. [思路] 二分+划分height,判定一个组中是否包含不小于R个不同字符串的后缀. 需要注意的有: 1)      c[]尽量开大,字符范围为“偏移”之后的范围. 2)      用kase作为标记节省了每次开始新段需要清零的时间. 3)      因为height是sa[i]与sa[i-1]的关系,所以无论是在can的开始还是在新段开始都需要初始为一个串的情况. [代…
Life Forms Time Limit: 5000MS   Memory Limit: 65536K Total Submissions: 12483   Accepted: 3501 Description You may have wondered why most extraterrestrial life forms resemble humans, differing by superficial traits such as height, colour, wrinkles, e…
(累了,这题做了很久!) Life Forms Time Limit: 5000MS   Memory Limit: 65536K Total Submissions: 8683   Accepted: 2375 Description You may have wondered why most extraterrestrial life forms resemble humans, differing by superficial traits such as height, colour,…