CF1503E.2-Coloring
NOI/NOI+/CTSC
通过率:0%
时间限制:3.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
There is a grid with n rows and m columns. Every cell of the grid should be colored either blue or yellow.
A coloring of the grid is called stupid if every row has exactly one segment of blue cells and every column has exactly one segment of yellow cells.
In other words, every row must have at least one blue cell, and all blue cells in a row must be consecutive. Similarly, every column must have at least one yellow cell, and all yellow cells in a column must be consecutive.
An example of a stupid coloring.
Examples of clever colorings. The first coloring is missing a blue cell in the second row, and the second coloring has two yellow segments in the second column.
How many stupid colorings of the grid are there? Two colorings are considered different if there is some cell that is colored differently.
有一个 n 行 m 列的网格。网格中的每个单元格必须被染成蓝色或黄色。
若一个网格染色方案满足:每一行恰好包含一段连续的蓝色单元格,且每一列恰好包含一段连续的黄色单元格,则称其为“愚蠢的”(stupid)染色方案。
换言之,每一行必须至少有一个蓝色单元格,且该行中所有蓝色单元格必须彼此相邻(即构成一个连续区间);同理,每一列必须至少有一个黄色单元格,且该列中所有黄色单元格也必须彼此相邻。
一个“愚蠢的”染色方案示例。
一些“聪明的”(clever)染色方案示例。第一个方案中第二行缺少蓝色单元格;第二个方案中第二列含有两段黄色单元格。
该网格共有多少种“愚蠢的”染色方案?若两个染色方案在某个单元格上的颜色不同,则认为它们是不同的染色方案。
输入格式
The only line contains two integers n, m (1≤n,m≤2021).
唯一的一行包含两个整数 n、m(1≤n,m≤2021)。
输出格式
Output a single integer — the number of stupid colorings modulo 998244353.
输出一个整数——愚蠢染色方案的数量对 998244353 取模的结果。
输入输出样例
输入#1
2 2
输出#1
2
输入#2
4 3
输出#2
294
输入#3
2020 2021
输出#3
50657649
说明/提示
In the first test case, these are the only two stupid 2×2 colorings.

在第一个测试用例中,仅有以下两种愚蠢的 2×2 染色方案。

输入解题思路,AI测评打分。不知道怎么写?