#P3804. 【模板】后缀自动机(SAM)

    ID: 2744 远端评测题 2000ms 500MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>字符串后缀自动机,SAMO2优化后缀数组,SA

【模板】后缀自动机(SAM)

Description

Given a string SS consisting only of lowercase letters.

Please find the maximum value of (occurrence count of a substring) multiplied by (the length of that substring) over all substrings of SS whose occurrence count is not 11.

Input Format

One line containing a string SS consisting only of lowercase letters.

Output Format

A single integer, the required answer.

abab
4

Hint

Constraints:

  • For 10%10\% of the testdata, S1000\lvert S \rvert \le 1000.

  • For 100%100\% of the testdata, 1S1061 \le \lvert S \rvert \le {10}^6.

  • 2023.7.30: Added a set of hack testdata.

Translated by ChatGPT 5