Codeforces Round 1004 (Div. 1)
D1
Club of Young Aircraft Builders (easy version)
Codeforces
2400
原题
← CD2 →
翻译中…

This is the easy version of the problem. The difference between the versions is that in this version, all $a_i = 0$. You can hack only if you solved all versions of this problem.

翻译中…

There is an $n$-story building, with floors numbered from $1$ to $n$ from bottom to top. There is exactly one person living on each floor.

翻译中…

All the residents of the building have a very important goal today: to launch at least $c$ paper airplanes collectively. The residents will launch the airplanes in turn. When a person from the $i$-th floor launches an airplane, all residents on the floors from $1$ to $i$ can see it as it descends to the ground.

翻译中…

If, from the perspective of the resident on the $i$-th floor, at least $c$ airplanes have already been launched, they will not launch any more airplanes themselves. It is also known that by the end of the day, from the perspective of each resident in the building, at least $c$ airplanes have been launched, and a total of $m$ airplanes were thrown.

翻译中…

You carefully monitored this flash mob and recorded which resident from which floor threw each airplane. Unfortunately, the information about who exactly threw some airplanes has been lost. Find the number of ways to fill in the gaps so that the information could be credible. Since the answer can be quite large, output it modulo $10^9 + 7$.

翻译中…

In this version of the problem, all information has been lost, and the entire array consists of gaps.

翻译中…

It is also possible that you made a mistake in your records, and there is no possible way to restore the gaps. In that case, the answer is considered to be $0$.

翻译中…

Input

翻译中…

Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 10^4$). The description of the test cases follows.

翻译中…

The first line of each test case contains three integers $n, c, m$ ($1 \le n \le 100$, $1 \le c \le 100$, $c \le m \le n \cdot c$) — the number of floors in the building, the minimum required number of airplanes, and the number of airplanes actually launched.

翻译中…

The second line of each test case contains $m$ integers $a_1, a_2, \ldots, a_m$ ($0 \le a_i \le n$) — $a_i$ indicates the resident from which floor launched the $i$-th airplane; $a_i = 0$ indicates a gap.

翻译中…

In this version of the problem, it is guaranteed that all $a_i = 0$.

翻译中…

It is guaranteed that the sum of the values of $m$ across all test cases does not exceed $10^4$.

翻译中…

Output

翻译中…

For each test case, output the number of ways to fill in the gaps with numbers from $1$ to $n$, so that the chronology of the airplane launches could be credible, modulo $10^9 + 7$.

翻译中…

Note

翻译中…

In the first test example, all six possible ways to fill in the gaps are as follows:

翻译中…
  1. $[1, 1, 3, 3]$
  2. $[1, 2, 3, 3]$
  3. $[1, 3, 2, 3]$
  4. $[2, 1, 3, 3]$
  5. $[2, 2, 3, 3]$
  6. $[3, 1, 2, 3]$
翻译中…

Note that the array $[2, 3, 1, 3]$ is not a valid way to fill in the gaps, as the third airplane could not have been launched by the person on the $1$st floor, since from their perspective, $c = 2$ airplanes had already been launched.

翻译中…

Also, the array $[1, 1, 2, 3]$ is not a valid way to fill in the gaps, as from the perspective of the person on the $3$rd floor, only $1$ airplane has been launched, while $c = 2$.

翻译中…

样例

Input #1
2
3 2 4
0 0 0 0
5 5 7
0 0 0 0 0 0 0
Output #1
6
190
InputCopy OutputCopy
题目信息
题号
2066D1
时间限制
4 s
内存限制
1024 MB
标签
组合数学
动态规划
数学

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