#P8594. 「KDOI-02」一个仇的复

    ID: 9578 远端评测题 3000ms 512MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>数学2022洛谷原创O2优化组合数学排列组合

「KDOI-02」一个仇的复

Background

Due to the OI contest format, subtasks are disabled for this problem. Some incorrect solutions may get high scores. Subtasks will be enabled after the contest.

"Have you heard about that incident? May they rest in peace."
"Huh? Look, what is that ring-shaped building ahead?"
"Let me compare it... Aha! This is their lair!"
"Destroy it, and avenge our fallen comrades!!!"
Dead cosmic rays point at fragile civilizations, ready to unleash their thunderous roar.

Problem Description

The aliens' space station has a ring-shaped structure. However, since the two ends of the ring are not connected, it can be approximated as a 2×n2\times n planar grid. Now, our ships have nn different types of ray weapons, each affecting a 1×x1\times x rectangle (xx is a positive integer). Also, the weapon can be rotated 9090^\circ clockwise or counterclockwise. The ray is extremely powerful: a single shot can annihilate everything within the affected area. However, if any part of the ray's affected area falls outside the target, it will keep extending to the end of the universe, greedily devouring everything along its path. The commander of course does not want to endanger innocent civilizations. He wants to know: among these nn weapons, if we choose kk types, how many different ways are there to destroy the aircraft.

[Formal statement]

You have infinitely many rectangles of size 1×x1\times x (xx can be any positive integer) and a 2×n2\times n grid. Find the number of ways to select exactly kk rectangles (you may select identical rectangles) to tile the entire grid without overlap and without gaps. Rectangles may be rotated.

Input Format

Read input from standard input.

The input contains one line with two positive integers n,kn,k.

Output Format

Write output to standard output.

Output one line with one positive integer, the number of tiling ways modulo 998244353998244353.

4 3

8

15 5
4015
3050 1314
670638639
19198114 4154
264122135

Hint


[Sample explanation]

  • Sample 1 explanation:
    There are 88 solutions as shown in the figure below.

[Constraints]

For 100%100\% of the testdata, 1n2×1071\le n\le 2\times 10^7, 1k50001\le k\le 5000.

Test Point ID Score nn kk
151\sim 5 22 5\leq5 10\leq10
6106\sim 10 1000\leq1000 =2n=2n
111511\sim 15 106\leq10^6 3\leq3
162016\sim 20 44 1000\leq1000 2n\leq2n
212521\sim 25 2×107\leq2\times10^7 100\leq100
263026\sim 30 106\leq10^6 5000\leq5000
314031\sim 40 11 2×107\leq2\times10^7

Note: the Score column is the score of a single test point.

Translated by ChatGPT 5