Codeforces Global Round 28
G
Kevin and Matrices
Codeforces
2800
原题
← FH →
翻译中…

Kevin has been transported to Sacred Heart Hospital, which contains all the $ n \times m $ matrices with integer values in the range $ [1,v] $.

翻译中…

Now, Kevin wants to befriend some matrices, but he is willing to befriend a matrix $ a $ if and only if the following condition is satisfied:

翻译中…

$$ \min_{1\le i\le n}\left(\max_{1\le j\le m}a_{i,j}\right)\le\max_{1\le j\le m}\left(\min_{1\le i\le n}a_{i,j}\right). $$

翻译中…

Please count how many matrices in Sacred Heart Hospital can be friends with Kevin.

翻译中…

Since Kevin is very friendly, there could be many matrices that meet this condition. Therefore, you only need to output the result modulo $998\,244\,353$.

翻译中…

Input

翻译中…

Each test contains multiple test cases. The first line contains the number of test cases $ t $ ($ 1 \le t \le 8\cdot 10^3 $).

翻译中…

The only line of each test case contains three integers $n$, $m$, $v$ ($ 1 \le n, v, n \cdot v \leq 10^6$, $1 \le m \le 10^9 $).

翻译中…

It is guaranteed that the sum of $ n \cdot v $ over all test cases doesn't exceed $ 10^6 $.

翻译中…

Output

翻译中…

For each test case, output one integer — the number of matrices that can be friends with Kevin modulo $998\,244\,353$.

翻译中…

Note

翻译中…

In the first test case, besides the matrices $ a=\begin{bmatrix}1&2\\2&1\end{bmatrix} $ and $ a=\begin{bmatrix}2&1\\1&2\end{bmatrix} $, which do not satisfy the condition, the remaining $ 2^{2 \cdot 2} - 2 = 14 $ matrices can all be friends with Kevin.

翻译中…

样例

Input #1
3
2 2 2
2 3 4
11 45 14
Output #1
14
2824
883799966
InputCopy OutputCopy
题目信息
题号
2048G
时间限制
6 s
内存限制
256 MB
标签
暴力
组合数学
动态规划
数学

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