AtCoder Regular Contest 143
B
Counting Grids
AtCoder
⌀ 1433
原题
← AC →
翻译中…

Problem Statement

翻译中…

Find the number of ways, modulo $998244353$, to fill the squares of an $N \times N$ grid using each integer from $1$ to $N^2$ once so that every square satisfies at least one of the following conditions.

翻译中…
  • In the same column, there is a square containing a number greater than that of the concerned square.
  • In the same row, there is a square containing a number less than that of the concerned square.
翻译中…

Constraints

翻译中…
  • $1 \leq N \leq 500$
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

N

翻译中…

Output

翻译中…

Print the answer.

翻译中…

样例

Input #1
2
Output #1
8
Here is one way to fill the grid to satisfy the requirement. Here, the top-left square contains a number less than that of the bottom-left square, satisfying the first condition. It does not satisfy the second condition, however.
Input #2
5
Output #2
704332752
Input #3
100
Output #3
927703658
题目信息
题号
arc143_b
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。