P29314 [洛谷] [Cnoi2020] Quadrilateral Chain
提高
题目描述

Problem Description

A quadrilateral chain can be abstracted as a $1 \times (n - 1)$ grid, where each cell is numbered from $1$ to $n-1$.

Each cell has two options:
- Leave it empty
- Fill it with a positive integer less than or equal to its own number

A filling scheme is considered legal if no two cells contain the same number.

Cirno wants to know the number of legal schemes where exactly $k$ cells are filled, modulo $998244353$.

Input Format

One line containing two integers $n$ and $k$.

Output Format

One line containing one integer, representing the answer.

Sample Input and Output

Sample Input #1

10 5

Sample Output #1

42525

Sample Input #2

642 357

Sample Output #2

409821948

Sample Input #3

666666 233333

Sample Output #3

791003566

Notes

Data Range

This problem uses batched testing.

  • Subtask1( $20\%$ ) : $n, k \le 10$
  • Subtask2( $20\%$ ) : $n, k \le 1000$
  • Subtask3( $60\%$ ) : No special constraints

For $100\%$ of the data: $0 \le k < n \le 10^6$.

Notes

  • The following references are not necessary for reading.

Reference

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
10 5
样例输出
42525