問題一覧 > 通常問題

No.1186 Rectangle Tiling

レベル : / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (解説公開後に AC するまで非表示) / 解いたユーザー数 208
作問者 : NatsubiSogan / テスター : kaage
お気に入りにしたユーザー ProblemId : 4676 / 自分の提出
問題文最終更新日: 2021-02-22 22:56:40
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
技術室奥プログラミングコンテスト#5 Day1 (順位表) の他の問題:

Problem Statement

You have an unlimited number of rectangular pieces of height $1$ and width $N$.

NatsubiSogan, who loves tiling rectangles, has given you the following order!

  • Use those pieces to tile a rectangle of height $N$ and width $M$ with no gaps.

Here, "tile" means to reach a state where every region of the rectangle is covered by exactly $1$ piece, without breaking pieces, overlapping pieces, or letting pieces extend outside the rectangle. For example, you cannot tile by placing pieces diagonally.

Unfortunately, you are very bad at puzzles. So you have decided to use a computer to find out how many such tilings there are.

Output this answer modulo $998244353$.

Note that the pieces of height $1$ and width $N$ may be rotated freely, and tilings that become identical by rotating or reflecting the whole rectangle are counted as distinct.

Input

$N\ M$

  • All inputs are integers.
  • $1 \leq N \leq 10^9$
  • $1 \leq M \leq 10^6$

Output

Output the answer modulo $998244353$ on one line.
Print a newline at the end.

Sample

Sample 1
Input
2 4
Output
5


As shown in the image, there are $5$ possible arrangements.

Sample 2
Input
3 4
Output
3


As shown in the image, there are $3$ possible arrangements.

Sample 3
Input
1000000000 1000000
Output
1

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。