AtCoder Grand Contest 059
翻译中…
Problem Statement
翻译中…
Given $N, pos, val$, find the number of permutations $P=(P_1, P_2, \ldots, P_N)$ of $(1,2,\ldots,N)$ that satisfy all of the following conditions, modulo $10^9+7$:
翻译中…
$LIS(P) + LDS(P) = N+1$$P_{pos} = val$
翻译中…
Here, $LIS(P)$ denotes the length of the longest increasing subsequence of $P$, and $LDS(P)$ denotes the length of the longest decreasing subsequence of $P$.
翻译中…
Constraints
翻译中…
$1 \le N \le 5\cdot 10^6$$1 \le pos, val \le N$- All values in the input are integers.
翻译中…
Input
翻译中…
Input is given from Standard Input in the following format:
翻译中…
N pos val
翻译中…
Output
翻译中…
Print the answer.
翻译中…
样例
Input #1
3 2 2
Output #1
2
The following permutations satisfy the conditions: $(1, 2, 3), (3, 2, 1)$.
Input #2
4 1 1
Output #2
6
The following permutations satisfy the conditions: $(1, 2, 3, 4), (1, 2, 4, 3), (1, 3, 2, 4), (1, 3, 4, 2), (1, 4, 2, 3), (1, 4, 3, 2)$.
Input #3
5 2 5
Output #3
11
Input #4
2022 69 420
Output #4
128873576
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。