spoj 687 Repeats//后缀数组
来源:互联网 发布:杭州淘宝运营培训 编辑:程序博客网 时间:2024/05/17 22:35
SPOJ Problem Set (classical)
687. Repeats
Problem code: REPEATS
A string s is called an (k,l)-repeat if s is obtained by concatenating k>=1 times some seed string t with length l>=1. For example, the string
s = abaabaabaaba
is a (4,3)-repeat with t = aba as its seed string. That is, the seed string t is 3 characters long, and the whole string s is obtained by repeating t 4 times.
Write a program for the following task: Your program is given a long string u consisting of characters ‘a’ and/or ‘b’ as input. Your program must find some (k,l)-repeat that occurs as substring within u with k as large as possible. For example, the input string
u = babbabaabaabaabab
contains the underlined (4,3)-repeat s starting at position 5. Since u contains no other contiguous substring with more than 4 repeats, your program must output the maximum k.
Input
In the first line of the input contains H- the number of test cases (H <= 20). H test cases follow. First line of each test cases is n - length of the input string (n <= 50000), The next n lines contain the input string, one character (either ‘a’ or ‘b’) per line, in order.
Output
For each test cases, you should write exactly one interger k in a line - the repeat count that is maximized.
Example
Input:117babbabaabaabaababOutput:4
- spoj 687 Repeats//后缀数组
- 【后缀数组】SPOJ REPEATS
- SPOJ REPEATS(后缀数组)
- SPOJ REPEATS 后缀数组
- spoj Repeats 后缀数组
- SPOJ 687 Repeats 后缀数组+暴力+rmq
- SPOJ 687 REPEATS Repeats 后缀数组 + RMQ预处理
- SPOJ 687. Repeats(后缀数组)
- SPOJ-REPEATS之后缀数组
- SPOJ 687 Repeats (后缀数组+RMQ 重复次数最多的连续重复子串)
- SPOJ 687. Repeats(后缀数组求最长重复子串)
- SPOJ SUBST1 POJ 2406 POJ REPEATS 后缀数组小结
- SPOJ REPEATS - Repeats(后缀数组[重复次数最多的连续重复子串])
- SPOJ题目687 Repeats(后缀数组+RMQ求重复次数最多的子串的重复次数)
- spoj 687 repeats
- Repeats (spoj 687)
- SPOJ687---REPEATS - Repeats(后缀数组+RMQ)
- spoj687 REPEATS - Repeats (后缀数组+rmq)
- HDU2273(点到线段距离)
- RegisterPropertyCategory
- 无法解析的外部符号 "int __cdecl
- MongoDB分片杂谈
- 关于句柄泄漏
- spoj 687 Repeats//后缀数组
- 用Ogre固定渲染管线实现火炬之光X-RAY效果
- MFC发布小软件的注意事项
- 几种DC及区别
- linux查看内核版本、系统版本、系统位数(32or64)
- 数字三角形!
- 平安证券策
- Fedora 15 Broadcom BCM4131 无线网卡驱动的安装
- COM Hook原理