QOJ.ac

QOJ

Limite de temps : 3.0 s Limite de mémoire : 1024 MB Points totaux : 100 Hackable ✓

#18407. 网格梯度

Statistiques

Nežmah 先生收到了一个 $n$ 行 $m$ 列的网格作为生日礼物。他想用 $1$ 到 $4$ 的整数填满它。由于他对渐变非常痴迷,他要求所有共享一条边的相邻单元格中填写的数字之差的绝对值必须恰好为 $1$。

由于他更痴迷于计数,请帮他求出满足条件的网格数量,结果对 $998\,244\,353$ 取模!

输入格式

第一行包含两个整数 $n$ 和 $m$ ($1 \le n, m \le 24$)。

输出格式

在单行中输出满足条件的网格数量,结果对 $998\,244\,353$ 取模。

样例

输入样例 1

1 2

输出样例 1

6

输入样例 2

3 2

输出样例 2

34

输入样例 3

7 10

输出样例 3

657297226

说明

在第一个样例中,恰好有六种方法可以填满该网格。它们分别是:$(1, 2)$、$(2, 1)$、$(2, 3)$、$(3, 2)$、$(3, 4)$、$(4, 3)$。

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.