CF1051D.Bicolorings

普及+/提高

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

You are given a grid, consisting of 22 rows and nn columns. Each cell of this grid should be colored either black or white.

Two cells are considered neighbours if they have a common border and share the same color. Two cells AA and BB belong to the same component if they are neighbours, or if there is a neighbour of AA that belongs to the same component with BB.

Let's call some bicoloring beautiful if it has exactly kk components.

Count the number of beautiful bicolorings. The number can be big enough, so print the answer modulo 998244353998244353.

给你一个由 22 行 nn 列组成的网格。该网格的每个格子需被染成黑色或白色。

若两个格子拥有公共边且颜色相同,则称它们为相邻。若两个格子 AA 和 BB 相邻,或存在 AA 的某个相邻格子与 BB 属于同一连通块,则称 AA 和 BB 属于同一连通块。

若某种双色染色方案恰好形成 kk 个连通块,则称其为优美的(beautiful)。

请计算优美的双色染色方案总数。答案可能很大,请对 998244353998244353 取模后输出。

输入格式

The only line contains two integers nn and kk (1≤n≤10001 \le n \le 1000, 1≤k≤2n1 \le k \le 2n) — the number of columns in a grid and the number of components required.

唯一一行包含两个整数 nn 和 kk(1≤n≤10001 \le n \le 1000,1≤k≤2n1 \le k \le 2n)—— 分别表示网格的列数和所需的连通块数量。

输出格式

Print a single integer — the number of beautiful bicolorings modulo 998244353998244353.

输出一个整数——美丽双色染色方案的数量对 998244353998244353 取模的结果。

输入输出样例

  • 输入#1

    3 4

    输出#1

    12
  • 输入#2

    4 1

    输出#2

    2
  • 输入#3

    1 2

    输出#3

    2

说明/提示

One of possible bicolorings in sample 11:

样例 11 中的一种可能的双色染色方案:

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

首页