P29240 [洛谷] "KDOI-02" A Vengeance
提高+
题目描述

Problem Background

Due to the OI competition format, subtasks are disabled, and partial incorrect solutions may score high. Subtasks will be enabled after the competition.

"Have you heard about that incident? May they rest in peace."
"Hey, look, what's that circular building ahead?"
"Let me compare it... Aha! That's their lair!"
"Destroy it, to avenge our fallen comrades!!"
Deadly cosmic rays are aimed at a fragile civilization, ready to unleash their thunderous roar.

Problem Description

The alien's space station is a circular structure. However, since the two ends of the ring are not connected, it can be approximated as a $2 \times n$ grid. Currently, there are $n$ different types of ray weapons, each with a range of $1 \times x$ ($x$ being a positive integer). The weapons can be rotated $90^\circ$ clockwise or counterclockwise. The rays are extremely powerful; just one shot can annihilate all objects within their range. However, if any part of the cosmic ray's range extends beyond the target, it will continue to the end of the universe, greedily devouring everything in its path. The commander certainly does not want to harm innocent civilizations, and he wants to know how many different ways there are to destroy the spacecraft by selecting $k$ types of weapons from these $n$ types.

[Formal Problem Statement]

You have an infinite number of rectangles of size $1 \times x$ ($x$ being any positive integer) and a grid of size $2 \times n$. You need to find the number of ways to exactly cover the entire grid with $k$ rectangles (you can choose the same type of rectangle) without overlap or gaps. Rectangles can be rotated.

Input Format

Input is read from the standard input.

The input consists of a single line with two positive integers $n$ and $k$.

Output Format

Output is written to the standard output.

Output a single positive integer, representing the number of ways, modulo $998244353$.

Sample Input and Output

Sample Input #1

4 3

Sample Output #1

8

Sample Input #2

15 5

Sample Output #2

4015

Sample Input #3

3050 1314

Sample Output #3

670638639

Sample Input #4

19198114 4154

Sample Output #4

264122135

Notes/Hints

[Sample Explanation]
+ Sample 1 Explanation:
There are 8 different ways as shown in the following diagram:

[Data Range]

For $100\%$ of the data, $1 \le n \le 2 \times 10^7$, $1 \le k \le 5000$.

Test Case Number Points $n$ $k$
$1 \sim 5$ $2$ $\leq 5$ $\leq 10$
$6 \sim 10$ $2$ $\leq 1000$ $= 2n$
$11 \sim 15$ $2$ $\leq 10^6$ $\leq 3$
$16 \sim 20$ $4$ $\leq 1000$ $\leq 2n$
$21 \sim 25$ $4$ $\leq 2 \times 10^7$ $\leq 100$
$26 \sim 30$ $4$ $\leq 10^6$ $\leq 5000$
$31 \sim 40$ $1$ $\leq 2 \times 10^7$ $\leq 5000$

Note: The points column refers to the points for a single test case.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
4 3
样例输出
8