#P4341. [BJWC2010] 外星联络

    ID: 3271 远端评测题 1000ms 125MiB 尝试: 0 已通过: 0 难度: 6 上传者: 标签>2010北京枚举,暴力后缀数组,SA

[BJWC2010] 外星联络

Description

After watching the movie "Contact" (超时空接触), Little P was deeply moved and decided to devote himself to the search for extraterrestrial life. Every night, he climbs onto the roof and tries to use his radio to listen for messages from aliens.

Although he hears only noise, he still rewrites the received signal into a string of 0s and 1s according to the high and low levels of the noise, and firmly believes that the aliens' message is hidden within. He believes that the message sent by the aliens must repeat within the binary string he received, so he wants to find all substrings of the binary string that appear more than 11 time.

However, the signal string he received is too long, so he hopes you can write a program to help him.

Input Format

The first line contains an integer NN, the length of the received signal string.
The second line contains a binary string of length NN, representing the received signal string.

Output Format

Output one line for each substring that appears more than 11 time, containing its number of occurrences. Output the lines in lexicographical order of the corresponding substrings.

7
1010101
3
3
2
2
4
3
3
2
2

Hint

For 100% of the testdata, 0N30000 \le N \le 3000.

Translated by ChatGPT 5