atcoder#AGC021F. [AGC021F] Trinity

[AGC021F] Trinity

Score : 18001800 points

Problem Statement

We have an N×MN \times M grid. The square at the ii-th row and jj-th column will be denoted as (i,j)(i,j). Particularly, the top-left square will be denoted as (1,1)(1,1), and the bottom-right square will be denoted as (N,M)(N,M). Takahashi painted some of the squares (possibly zero) black, and painted the other squares white.

We will define an integer sequence AA of length NN, and two integer sequences BB and CC of length MM each, as follows:

  • Ai(1iN)A_i(1\leq i\leq N) is the minimum jj such that (i,j)(i,j) is painted black, or M+1M+1 if it does not exist.
  • Bi(1iM)B_i(1\leq i\leq M) is the minimum kk such that (k,i)(k,i) is painted black, or N+1N+1 if it does not exist.
  • Ci(1iM)C_i(1\leq i\leq M) is the maximum kk such that (k,i)(k,i) is painted black, or 00 if it does not exist.

How many triples (A,B,C)(A,B,C) can occur? Find the count modulo 998244353998244353.

Notice

In this problem, the length of your source code must be at most 2000020000 B. Note that we will invalidate submissions that exceed the maximum length.

Constraints

  • 1N80001 \leq N \leq 8000
  • 1M2001 \leq M \leq 200
  • NN and MM are integers.

Partial Score

  • 15001500 points will be awarded for passing the test set satisfying N300N\leq 300.

Input

Input is given from Standard Input in the following format:

N M

Output

Print the number of triples (A,B,C)(A,B,C), modulo 998244353998244353.

2 3
64

Since N=2N=2, given BiB_i and CiC_i, we can uniquely determine the arrangement of black squares in each column. For each ii, there are four possible pairs (Bi,Ci)(B_i,C_i): (1,1)(1,1), (1,2)(1,2), (2,2)(2,2) and (3,0)(3,0). Thus, the answer is 4M=644^M=64.

4 3
2588
17 13
229876268
5000 100
57613837