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

    ID: 7832 Type: RemoteJudge 2000ms 500MiB Tried: 44 Accepted: 13 Difficulty: 8 Uploaded By: Tags>后缀数组SA后缀自动机SAM字符串O2优化

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

Problem 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