ユニークビジョンプログラミングコンテスト2024 クリスマス(AtCoder Beginner Contest 385)
G
Counting Buildings
AtCoder
⌀ 2492
原题
翻译中…

Problem Statement

翻译中…

For a permutation $P=(P_1,P_2,\dots,P_N)$ of $(1,2,\dots,N)$, define integers $L(P)$ and $R(P)$ as follows:

翻译中…
  • Consider $N$ buildings arranged in a row from left to right, with the height of the $i$-th building from the left being $P_i$. Then $L(P)$ is the number of buildings visible when viewed from the left, and $R(P)$ is the number of buildings visible when viewed from the right. More formally, $L(P)$ is the count of indices $i$ such that $P_j < P_i$ for all $j < i$, and $R(P)$ is the count of indices $i$ such that $P_i > P_j$ for all $j > i$.
翻译中…

You are given integers $N$ and $K$. Find, modulo $998244353$, the count of all permutations $P$ of $(1,2,\dots,N)$ such that $L(P)-R(P)=K$.

翻译中…

Constraints

翻译中…
  • $1 \leq N \leq 2 \times 10^5$
  • $|K| \leq N-1$
  • All input values are integers.
翻译中…

Input

翻译中…

The input is given from Standard Input in the following format:

翻译中…

N K

翻译中…

Output

翻译中…

Print the answer.

翻译中…

样例

Input #1
3 -1
Output #1
1
- $P=(1,2,3)$: $L(P)-R(P)=3-1=2$. - $P=(1,3,2)$: $L(P)-R(P)=2-2=0$. - $P=(2,1,3)$: $L(P)-R(P)=2-1=1$. - $P=(2,3,1)$: $L(P)-R(P)=2-2=0$. - $P=(3,1,2)$: $L(P)-R(P)=1-2=-1$. - $P=(3,2,1)$: $L(P)-R(P)=1-3=-2$. Therefore, the number of permutations $P$ with $L(P)-R(P)=-1$ is $1$.
Input #2
1 0
Output #2
1
Input #3
2024 385
Output #3
576300012
Print the count modulo $998244353$.

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。