atcoder#AGC024E. [AGC024E] Sequence Growing Hard
[AGC024E] Sequence Growing Hard
Score : points
Problem Statement
Find the number of the possible tuples of sequences that satisfy all of the following conditions, modulo :
- For every , is a sequence of length consisting of integers between and (inclusive);
- For every , is a subsequence of , that is, there exists such that the removal of the -th element of would result in a sequence equal to ;
- For every , is lexicographically larger than .
Constraints
- , and are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the number of the possible tuples of sequences , modulo .
2 2 100
5
Five tuples below satisfy the conditions:
4 3 999999999
358
150 150 998244353
186248260