| Codeforces Round 1083 (Div. 2) |
|---|
| Finished |
Consider that Simons is given an array $$$a$$$ of size $$$m$$$.
Simons must operate on the array exactly once as follows:
You are given an array $$$T$$$ of size $$$n$$$. Count the number of arrays $$$S$$$ such that Simons can transform $$$S$$$ to $$$T$$$, modulo $$$998\,244\,353$$$.
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 8000$$$). The description of the test cases follows.
The first line contains an integer $$$n$$$ ($$$1\le n\le 8000$$$) — the length of $$$T$$$.
The second line contains $$$n$$$ integers $$$T_1,T_2,\ldots,T_n$$$ ($$$1\le T_i\le 8000$$$) — the elements of $$$T$$$.
It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$8000$$$.
For each test case, output a single integer — the number of arrays $$$S$$$, modulo $$$998\,244\,353$$$.
541 1 2 141 2 3 161 3 2 3 3 2102 3 1 4 3 1 4 3 1 218000
47223831
In the first test case, we can see only the following arrays can be transformed to $$$T$$$:
In the second test case, we can see only the following arrays can be transformed to $$$T$$$:
| Name |
|---|


