atcoder#ABC237F. [ABC237F] |LIS| = 3
[ABC237F] |LIS| = 3
Score : points
Problem Statement
Find the number of sequences that satisfy all of the conditions below, modulo .
- The length is .
- Each of the elements is an integer between and (inclusive).
- Its longest increasing subsequence has the length of exactly .
Notes
A subsequence of a sequence is the result of removing zero or more elements from it and concatenating the remaining elements without changing the order. For example, is a subsequence of , while is not a subsequence of .
A longest increasing subsequence of a sequence is its strictly increasing subsequence with the greatest length.
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
4 5
135
One sequence that satisfies the conditions is . On the other hand, do not, because its longest increasing subsequence has the length of .
3 4
4
111 3
144980434
Find the count modulo .