字符串练习题:SPOJ 220 Relevant Phrases of Annihilation(后缀数组加二分)
2015-02-07 21:49
513 查看
转载请注明出处,谢谢/article/2566293.html
by---cxlove
题目:给定n个字符串,求出每个字符串至少出现两次且不重叠的最长子串
http://www.spoj.pl/problems/PHRASES/
另外同类型练习题:http://poj.org/problem?id=1226
and claims that he may only decrypt the most important part of the text (since the rest would be a waste of his time). You decide to select the fragment of the text which the enemy has strongly emphasised, evidently regarding it as the most important. So,
you are looking for a fragment of text which appears in all the messages disjointly at least twice. Since you are not overfond of the cryptographer, try to make this fragment as long as possible.
10000 characters 'a'-'z', possibly with some additional trailing white space which should be ignored.
(in the example above, the longest substring which fulfills the requirements is 'ba')
by---cxlove
题目:给定n个字符串,求出每个字符串至少出现两次且不重叠的最长子串
http://www.spoj.pl/problems/PHRASES/
另外同类型练习题:http://poj.org/problem?id=1226
220. Relevant Phrases of Annihilation
Problem code: PHRASES
You are the King of Byteland. Your agents have just intercepted a batch of encrypted enemy messages concerning the date of the planned attack on your island. You immedietaly send for the Bytelandian Cryptographer, but he is currently busy eating popcornand claims that he may only decrypt the most important part of the text (since the rest would be a waste of his time). You decide to select the fragment of the text which the enemy has strongly emphasised, evidently regarding it as the most important. So,
you are looking for a fragment of text which appears in all the messages disjointly at least twice. Since you are not overfond of the cryptographer, try to make this fragment as long as possible.
Input
The first line of input contains a single positive integer t<=10, the number of test cases. t test cases follow.Each test case begins with integer n (n<=10), the number of messages. The next n lines contain the messages, consisting only of between 2 and10000 characters 'a'-'z', possibly with some additional trailing white space which should be ignored.
Output
For each test case output the length of longest string which appears disjointly at least twice in all of the messages.Example
Input: 1 4 abbabba dabddkababa bacaba baba Output: 2
(in the example above, the longest substring which fulfills the requirements is 'ba')
Added by: | Adrian Kosowski |
Date: | 2004-10-11 |
Time limit: | 9s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel Pentium G860 3GHz) |
Languages: | All except: NODEJS PERL 6 SCM chicken VB.net |
Resource: | DASM Programming League 2004 (problemset 1) |
相关文章推荐
- SPOJ 220 Relevant Phrases of Annihilation(后缀数组+二分答案)
- SPOJ220---Relevant Phrases of Annihilation(后缀数组+二分,对后缀分组)
- [SPOJ220]PHRASES - Relevant Phrases of Annihilation(后缀数组+二分)
- SPOJ220---Relevant Phrases of Annihilation(后缀数组+二分,对后缀分组)
- SPOJ 220 Relevant Phrases of Annihilation(后缀数组+二分)
- 【SPOJ220】Relevant Phrases of Annihilation(后缀数组,二分)
- spoj 220 Relevant Phrases of Annihilation (后缀数组 每个串中都至少出现两次的不重叠最长子串)
- 【后缀数组】【spoj 220】Relevant Phrases of Annihilation
- spoj 220 Relevant Phrases of Annihilation(每个字符串至少出现两次且不重叠的最长子串)
- SPOJ 220 Relevant Phrases of Annihilation(每个字符串至少出现两次且不重叠的最长子串)
- 【SPOJ】220 Relevant Phrases of Annihilation
- Relevant Phrases of Annihilation spoj220
- SPOJ 220 . Relevant Phrases of Annihilation(后缀数组)
- SPOJ 220 Relevant Phrases of Annihilation
- spoj 220 Relevant Phrases of Annihilation (后缀数组应用)
- SPOJ 220 Relevant Phrases of Annihilation(后缀数组)
- SPOJ 220 Relevant Phrases of Annihilation (后缀数组)
- SPOJ - PHRASES Relevant Phrases of Annihilation (n个字符串中求至少出现两次且不重叠的最长子串)
- spoj220 Relevant Phrases of Annihilation
- spoj 220 Relevant Phrases of Annihilation(n个串的最长公共重复2次子串)