#P1567. Count the Arrays
Count the Arrays
题目描述
Your task is to calculate the number of arrays such that:
- each array contains elements;
- each element is an integer from to ;
- for each array, there is exactly one pair of equal elements;
- for each array , there exists an index such that the array is strictly ascending before the -th element and strictly descending after it (formally, it means that < , if < , and > , if
中文题目
求满足如下条件的数列个数,答案对取模: 长度为 每个元素值域为到 有且仅有一对相等的元素 存在下标,满足 数据范围:
输入描述
The first line contains two integers and ().
输出描述
Print one integer — the number of arrays that meet all of the aforementioned conditions, taken modulo .
样例
3 4
6
3 5
10
42 1337
806066790
100000 200000
707899035
提示
The arrays in the first example are:
- ;
- ;
- ;
- ;
- ;
- .