{"problem":{"name":"Trinity","description":{"content":"We have an $N \\times M$ grid. The square at the $i$\\-th row and $j$\\-th column will be denoted as $(i,j)$. Particularly, the top-left square will be denoted as $(1,1)$, and the bottom-right square wil","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":6000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"agc021_f"},"statements":[{"statement_type":"Markdown","content":"We have an $N \\times M$ grid. The square at the $i$\\-th row and $j$\\-th column will be denoted as $(i,j)$. Particularly, the top-left square will be denoted as $(1,1)$, and the bottom-right square will be denoted as $(N,M)$. Takahashi painted some of the squares (possibly zero) black, and painted the other squares white.\nWe will define an integer sequence $A$ of length $N$, and two integer sequences $B$ and $C$ of length $M$ each, as follows:\n\n*   $A_i(1\\leq i\\leq N)$ is the minimum $j$ such that $(i,j)$ is painted black, or $M+1$ if it does not exist.\n*   $B_i(1\\leq i\\leq M)$ is the minimum $k$ such that $(k,i)$ is painted black, or $N+1$ if it does not exist.\n*   $C_i(1\\leq i\\leq M)$ is the maximum $k$ such that $(k,i)$ is painted black, or $0$ if it does not exist.\n\nHow many triples $(A,B,C)$ can occur? Find the count modulo $998244353$.\n\n## Constraints\n\n*   $1 \\leq N \\leq 8000$\n*   $1 \\leq M \\leq 200$\n*   $N$ and $M$ are integers.\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$N$ $M$\n\n## Output\n\nPrint the number of triples $(A,B,C)$, modulo $998244353$.\n\n[samples]\n\n## Notice\n\nIn this problem, the length of your source code must be at most $20000$ B. Note that we will invalidate submissions that exceed the maximum length.","is_translate":false,"language":"English"}],"meta":{"iden":"agc021_f","tags":[],"sample_group":[["2 3","64\n\nSince $N=2$, given $B_i$ and $C_i$, we can uniquely determine the arrangement of black squares in each column. For each $i$, there are four possible pairs $(B_i,C_i)$: $(1,1)$, $(1,2)$, $(2,2)$ and $(3,0)$. Thus, the answer is $4^M=64$."],["4 3","2588"],["17 13","229876268"],["5000 100","57613837"]],"created_at":"2026-03-03 11:01:13"}}