「一本通 2.1 练习 4」A Horrible Poem
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
Description
Original source: POI 2012
Given a string consisting of lowercase English letters, and queries, each query asks for the length of the shortest cycle in a substring of .
A string is a cycle of string if can be formed by repeating multiple times.
Input Format
The first line contains a positive integer , the length of .
The second line contains lowercase English letters, representing the string .
The third line contains a positive integer , the number of queries.
The following lines each contain two positive integers and , representing the query for the substring and asking for the length of its shortest cycle.
Output Format
Output lines of positive integers, where the -th line corresponds to the answer for the -th query.
Sample 1
8
aaabcabc
3
1 3
3 8
4 8
1
3
5
Constraints and Hints
.
20251117 D班作业(6)
- Status
- Done
- Problem
- 4
- Open Since
- 2025-11-17 0:00
- Deadline
- 2025-11-25 23:59
- Extension
- 24 hour(s)