大和証券プログラミングコンテスト2022 Spring (AtCoder Regular Contest 138)
E
Decreasing Subsequence
AtCoder
⌀ 3624
原题
← DF →
翻译中…

Problem Statement

翻译中…

You are given integers $N$ and $K$. Let us call an integer sequence $A=(A_1,A_2,\cdots,A_N)$ good when it satisfies all of the conditions below.

翻译中…
  • $0 \leq A_i \leq i$ ($1 \leq i \leq N$)
  • For every integer $v=1,2,\cdots,N$, there is at most one index $i$ such that $A_i=v$.
翻译中…

Find the sum, modulo $(10^9+7)$, of the answers to the following problem for all good sequences $A$.

翻译中…
  • Find the number of length-$K$ (not necessarily contiguous) subsequences of $A$ consisting of positive integers that are decreasing. In other words, find the number of sequences of indices $1 \leq i_1 < i_2 < \cdots < i_K \leq N$ such that $A_{i_1}>A_{i_2}>\cdots>A_{i_K} \geq 1$.
翻译中…

Constraints

翻译中…
  • $3 \leq N \leq 5000$
  • $2 \leq K$
  • $2K-1 \leq N$
  • All values in input are integers.
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

N K

翻译中…

Output

翻译中…

Print the answer.

翻译中…

样例

Input #1
3 2
Output #1
1
For example, $A=(0,2,1)$ is a good sequence, with one subsequence satisfying the condition. There are other good sequences such as $A=(0,1,0),(1,2,3),(0,0,0)$, but none of them has subsequences satisfying the condition. In the end, no good sequence other than $A=(0,2,1)$ has subsequences satisfying the condition, so the answer is $1$.
Input #2
6 2
Output #2
660
Input #3
10 3
Output #3
242595
Input #4
100 10
Output #4
495811864
题目信息
题号
arc138_e
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。