CF1027E.Inverse Coloring

提高+/省选-

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

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

题目描述

You are given a square board, consisting of nn rows and nn columns. Each tile in it should be colored either white or black.

Let's call some coloring beautiful if each pair of adjacent rows are either the same or different in every position. The same condition should be held for the columns as well.

Let's call some coloring suitable if it is beautiful and there is no rectangle of the single color, consisting of at least kk tiles.

Your task is to count the number of suitable colorings of the board of the given size.

Since the answer can be very large, print it modulo 998244353998244353.

你被给定一个 nn 行 nn 列的方阵。其中每个格子需被染成白色或黑色。

我们称一种染色方案是优美的,当且仅当任意两个相邻的行在每个位置上要么完全相同,要么完全相反;列也需满足同样的条件。

我们称一种染色方案是合适的,当且仅当它既是优美的,且不存在由同一种颜色构成、且包含至少 kk 个格子的矩形。

你的任务是计算给定尺寸的方阵中合适的染色方案数。

由于答案可能非常大,请对 998244353998244353 取模后输出。

输入格式

A single line contains two integers nn and kk (1≤n≤5001 \le n \le 500, 1≤k≤n21 \le k \le n^2) — the number of rows and columns of the board and the maximum number of tiles inside the rectangle of the single color, respectively.

一行包含两个整数 nn 和 kk(1≤n≤5001 \le n \le 500,1≤k≤n21 \le k \le n^2)—— 分别表示棋盘的行数与列数,以及单色矩形区域内最多可包含的方块数量。

输出格式

Print a single integer — the number of suitable colorings of the board of the given size modulo 998244353998244353.

输出一个整数——给定尺寸棋盘的合适染色方案数对 998244353998244353 取模的结果。

输入输出样例

  • 输入#1

    1 1

    输出#1

    0
  • 输入#2

    2 3

    输出#2

    6
  • 输入#3

    49 1808

    输出#3

    359087121

说明/提示

Board of size 1×11 \times 1 is either a single black tile or a single white tile. Both of them include a rectangle of a single color, consisting of 11 tile.

Here are the beautiful colorings of a board of size 2×22 \times 2 that don't include rectangles of a single color, consisting of at least 33 tiles:

The rest of beautiful colorings of a board of size 2×22 \times 2 are the following:

1×11 \times 1 的棋盘要么由一块黑色方砖构成,要么由一块白色方砖构成。这两种情况均包含一个单色矩形,该矩形由 11 块方砖组成。

以下为 2×22 \times 2 棋盘的所有“优美着色”方案,其中不包含由至少 33 块同色方砖组成的单色矩形:

其余的 2×22 \times 2 棋盘的“优美着色”方案如下:

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

首页