No.3563 No T-Junctions in Kyoto
タグ : / 解いたユーザー数 32
作問者 :
jastaway
yaaya
butsurizuki
Problem Statement
Kyoto City consists of $N \times M$ blocks arranged in a grid with $N$ rows running north to south and $M$ columns running east to west. The city is to be divided into several special wards.
Each special ward must be connected in the north, south, east, and west directions. That is, for any 2 blocks belonging to the same special ward, it must be possible to travel between them by moving only through blocks of that ward that are adjacent by sharing an edge.
When adjacent blocks belong to different special wards, a main road separating the blocks is built along their boundary. However, to prevent traffic congestion, no T-junction may be created in the interior of the grid. That is, at any intersection in the interior of the grid, the number of main roads connected to it must not be exactly $3$.
Find the total number of divisions into special wards satisfying the conditions, modulo $998244353$. Here, 2 ways of dividing are considered the same division if and only if, for any 2 blocks, whether those blocks belong to the same special ward agrees between them.
Input
The input is given from Standard Input in the following format.
$N$ $M$
- $1 \le N, M \le 3000$
- All input values are integers.
Partial Score
This problem has partial scoring based on subtasks.
| Subtask | Score | Constraints |
|---|---|---|
| 部分点1 | 10% (30 pts) | $N = 1$ |
| 満点 | 90% (270 pts) | 追加の制約はない |
Output
Output the answer on $1$ line.
Sample
Sample 1
Input
2 2
Output
8
There are the following $8$ ways to divide the $2 \times 2$ blocks into special wards so that no T-junction is created in the interior.
For example, if the blocks are divided into 3 special wards as shown below, 3 main roads meet at the central intersection, creating a T-junction, so the conditions are not satisfied.
Sample 2
Input
1 1
Output
1
Since there is only $1$ block, there is only $1$ way: making the whole city $1$ special ward without dividing it. There are no intersections in the interior, so no T-junction can be created.
Sample 3
Input
2026 529
Output
996014394
Note that you should find the remainder modulo $998244353$.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。