P11057 Scam Problem

Background

This is a scam problem.

Description

Define $f(n,m)$ as the answer to the following problem. > Consider an $n \times m$ black-and-white grid, which is initially all white. Each operation is as follows: > - Choose a white cell $(x,y)$ and paint the entire row containing it black. This operation is called $(x,y,\text{R})$. > - Choose a white cell $(x,y)$ and paint the entire column containing it black. This operation is called $(x,y,\text{C})$. > > Suppose you can perform at most $k$ operations. Ask: > > - Among all plans that perform $k$ operations, how many essentially different **operation sets** are there? An operation set is a set of size $k$ representing the $k$ operations that were performed. (Note that two plans with different orders but the same operation set are only counted once.) Two operation sets $A, B$ are called essentially different if and only if there exists an operation $opt$ such that $[opt \in A] + [opt \in B] = 1$. Now given $n, m$, please compute the value of $f(i,j)$ for all $1 \le i \le n,\ 1 \le j \le m$. Since the answer may be large, you only need to output it modulo $998244353$.

Input Format

One line containing two positive integers $n, m$.

Output Format

Output a matrix with $n$ rows and $m$ columns. The number in row $i$ and column $j$ should be $f(i,j) \bmod 998244353$.

Explanation/Hint

### Sample Explanation For $f(1, 2)$, we have $k = 2$. There are the following $3$ possible operation sets: - $\{(1, 1, \text R), (1, 2, \text C)\}$ - $\{(1, 1, \text C), (1, 2, \text R)\}$ - $\{(1, 1, \text C), (1, 2, \text C)\}$ Note that for the last set, there is more than one operation order, but since they correspond to the same operation set, it is only counted once in the answer. ### Constraints **The Luogu code length limit is $\textbf{50\ KB}$.** | Test Point ID | $n=$ | $m=$ | | :----------: | :----------: | :----------: | | $1$ | $2$ | $2$ | | $2$ | $3$ | $3$ | | $3$ | $5$ | $5$ | | $4$ | $10$ | $10$ | | $5$ | $20$ | $20$ | | $6$ | $50$ | $50$ | | $7$ | $100$ | $100$ | | $8$ | $1$ | $200$ | | $9$ | $2$ | $200$ | | $10$ | $300$ | $300$ | For all testdata, it is guaranteed that $1 \le n,m \le 300$。 Translated by ChatGPT 5