시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
5 초 (추가 시간 없음) | 1024 MB | 0 | 0 | 0 | 0.000% |
We call an $n \times n$ matrix containing only 0
s and 1
s bad if and only if it contains exactly one 1
in each row and column.
Bad | Bad | Bad | Not Bad | Not Bad | Not Bad |
---|---|---|---|---|---|
$\left[\begin{matrix}0 & 1\\1 & 0\end{matrix}\right]$ | $\left[\begin{matrix}1 & 0\\0 & 1\end{matrix}\right]$ | $\left[\begin{matrix}1 & 0 & 0\\0 & 0 & 1\\0 & 1 & 0\end{matrix}\right]$ | $\left[\begin{matrix}1 & 1 & 0\\1 & 0 & 1\\0 & 1 & 1\end{matrix}\right]$ | $\left[\begin{matrix}0 & 0 & 0\\0 & 1 & 0\\0 & 0 & 0\end{matrix}\right]$ | $\left[\begin{matrix}0 & 0\\0 & 0\end{matrix}\right]$ |
Define $B$ to be a subrectangle of an $n \times n$ matrix $A$ if and only if there exist $1 \le l_1 \le r_1 \le n$ and $1 \le l_2 \le r_2 \le n$ such that
$A$ | $B$ | Explanation |
---|---|---|
$\left[\begin{matrix}1 & 0 & 0\\0 & 0 & 1\\0 & 1 & 1\end{matrix}\right]$ | $\left[\begin{matrix}0 & 0\\ 0 & 1\end{matrix}\right]$ | $\left[\begin{matrix}1 & \mathbf{0} & \mathbf{0}\\0 & \mathbf{0} & \mathbf{1}\\0 & 1 & 1\end{matrix}\right]$ |
$\left[\begin{matrix}1 & 0 & 0\\0 & 0 & 1\\0 & 1 & 1\end{matrix}\right]$ | $\left[\begin{matrix}1 & 0\\ 0 & 0\end{matrix}\right]$ | $\left[\begin{matrix}\mathbf{1} & \mathbf{0} & 0\\\mathbf{0} & \mathbf{0} & 1\\0 & 1 & 1\end{matrix}\right]$ |
$\left[\begin{matrix}1 & 0 & 0\\0 & 0 & 1\\0 & 1 & 1\end{matrix}\right]$ | $\left[\begin{matrix}1 & 0\\ 0 & 1\end{matrix}\right]$ | Not a subrectangle |
Given two integers $n$ and $m$, you want to calculate how many $n \times n$ matrices $M$ containing only 0
s and 1
s are there such that:
Since the answer can be large, output it modulo $998\,244\,353$.
The first line contains two integers $n$ and $m$ ($1 \le m < n \le 10^5$).
Output a single line containing a single integer, indicating the answer modulo $998\,244\,353$.
3 2
6
4 2
4
300 20
368258992
100000 1
91844344
In the first example, there are $6$ bad matrices. The second condition does not matter since $m + 1 = 3 > n - 1 = 2$. So the answer is $6$.
In the second example, there are $4$ matrices satisfying the conditions:
$\left[\begin{matrix}0 & 1 & 0 & 0\\0 & 0 & 0 & 1 \\ 1 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 \end{matrix}\right]$ | $\left[\begin{matrix}0 & 0 & 1 & 0\\1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 1 & 0 & 0 \end{matrix}\right]$ | $\left[\begin{matrix}0 & 0 & 1 & 0\\0 & 0 & 0 & 1 \\ 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \end{matrix}\right]$ | $\left[\begin{matrix}0 & 1 & 0 & 0\\1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \end{matrix}\right]$ |