| Hello 2026 |
|---|
| Finished |
You are given a sequence $$$a$$$ of length $$$n$$$ and a positive integer $$$m$$$. Each element of $$$a$$$ is an integer in the range $$$[0, m]$$$.
A sequence $$$a$$$ is considered good if and only if the following two conditions hold:
You need to replace all zeros in $$$a$$$ with integers from the range $$$[1, m]$$$. Calculate the number of different ways to replace the zeros such that the resulting sequence $$$a$$$ is good.
Print the answer modulo $$$998\,244\,353$$$.
$$$^{\text{∗}}$$$The Least common multiple ($$$\operatorname{lcm}$$$) of two positive integers is the smallest positive integer that is a multiple of both. For example, $$$\operatorname{lcm}(2,3)=6, \operatorname{lcm}(4,6)=12$$$.
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 1000$$$). The description of the test cases follows.
The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$2 \le n\le m \le 3000$$$).
The second line of each test case contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$0 \le a_i \le m$$$).
It is guaranteed that the sum of $$$m$$$ over all test cases does not exceed $$$3000$$$.
For each test case, output a single integer — the number of ways to complete the sequence so that it becomes good, modulo $$$998\,244\,353$$$.
54 61 0 0 62 22 15 240 0 4 0 05 60 0 6 0 020 20001 0 0 0 0 14 0 0 0 0 0 0 0 0 0 514 0 0 0 0
20100973702700
In the first test case, there are $$$2$$$ ways to replace the zeros such that the sequence becomes good:
In the second test case, the initial sequence is $$$[2, 1]$$$. Since $$$2 \not \lt 1$$$, the strictly increasing condition is not met, so the answer is $$$0$$$.
In the fourth test case, the sequence is fixed to be $$$[0, 0, 6, 0, 0]$$$ with $$$m=6$$$. The third element is $$$6$$$. Since the sequence must be strictly increasing and elements cannot exceed $$$6$$$, we would need $$$6 \lt a_4 \lt a_5 \le 6$$$, which is impossible.
| Name |
|---|


