#abc262h. Ex - Max Limited Sequence
Ex - Max Limited Sequence
Score : points
问题陈述
求满足以下所有条件的整数序列 的个数,模 :
- 对于所有满足 的 ,有 。
- 对于所有满足 的 ,子序列 的最大值为 。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
Find the number, modulo , of integer sequences of length that satisfy all of the following conditions:
- for all such that .
- The maximum value of is for all such that .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
3 3 2
1 2 2
2 3 3
Sample Output 1
5
$A = (0, 2, 3), (1, 2, 3), (2, 0, 3), (2, 1, 3), (2, 2, 3)$ satisfy the conditions.
Sample Input 2
1 1 1
1 1 1
Sample Output 2
1
Sample Input 3
6 40000000 3
1 4 30000000
2 6 20000000
3 5 10000000
Sample Output 3
135282163
update @ 2024/3/10 11:06:59