#P15757. [JAG 2025 Summer Camp #1] Inversion of Suffix Array
[JAG 2025 Summer Camp #1] Inversion of Suffix Array
题目描述
You are given positive integers , and a string of length consisting of lowercase English letters.
Let be the string obtained by concatenating copies of .
Find the inversion number of the Suffix Array of , modulo .
For a string of length , the suffix array of is a permutation of integers from to that represents the starting positions of all non-empty suffixes of , sorted in lexicographical order.
输入格式
The input is given in the following format:
- is a string of length consisting of lowercase English letters.
- and are integers.
输出格式
Output the answer in a single line.
4 2
icpc
18
13 92025
jagsummercamp
996562345