Matrix Counting

아직 제출이 없습니다시간 제한5초메모리 제한1024 MB

문제

We call an n×nn \times n matrix containing only 0s and 1s bad if and only if it contains exactly one 1 in each row and column.

BadBadBadNot BadNot BadNot 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 BB to be a subrectangle of an n×nn \times n matrix AA if and only if there exist 1l_1r_1n1 \le l\_1 \le r\_1 \le n and 1l_2r_2n1 \le l\_2 \le r\_2 \le n such that

  • BB is a (r_1l_1+1)×(r_2l_2+1)(r\_1-l\_1+1) \times (r\_2-l\_2+1) matrix.
  • B_i,j=A_l_1+i1,r_1+j1B\_{i,j} = A\_{l\_1+i-1, r\_1+j-1} (1ir_1l_1+1,1jr_2l_2+11 \le i \le r\_1-l\_1+1, 1 \le j \le r\_2-l\_2+1)
AABBExplanation
\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 nn and mm, you want to calculate how many n×nn \times n matrices MM containing only 0s and 1s are there such that:

  1. MM is bad,
  2. all its subrectangles of size k×kk \times k (k=m+1,m+2,,n1k = m + 1, m + 2, \ldots, n - 1) are not bad.

Since the answer can be large, output it modulo 998,244,353998\\,244\\,353.

입력

The first line contains two integers nn and mm (1m<n1051 \le m < n \le 10^5).

출력

Output a single line containing a single integer, indicating the answer modulo 998,244,353998\\,244\\,353.

힌트

In the first example, there are 66 bad matrices. The second condition does not matter since m+1=3>n1=2m + 1 = 3 > n - 1 = 2. So the answer is 66.

In the second example, there are 44 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]