問題一覧 > 通常問題

No.1762 🐙🐄🌲

レベル : / AI推定難易度 : 2550 / 実行時間制限 : 1ケース 4.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (解説公開後に AC するまで非表示) / 解いたユーザー数 10
作問者 : NyaanNyaan / テスター : tokusakurai PCTprobability
お気に入りにしたユーザー ProblemId : 7119 / 自分の提出
問題文最終更新日: 2021-11-20 20:47:13
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 324 (順位表) の他の問題:

Problem Statement

Nyaan, who loves polynomials, has decided to make polynomials by combining "octopuses" and "cows".

A tree satisfying the following conditions is called an octopus-cow tree with $N$ vertices.

  • The vertices are numbered from $1$ to $N$, and each vertex has a picture of either an "octopus" or a "cow" drawn on it.
  • The degree of a vertex with a picture of an "octopus" is $\mathbf{8}$ or less.
  • The degree of a vertex with a picture of a "cow" is $\mathbf{4}$.
  • Vertices with the same picture are not adjacent.

Also, among the vertices of an octopus-cow tree, a vertex with a picture of an "octopus" and degree $8$ is called a "perfect octopus".

You are given $N, P$. Find the number of octopus-cow trees with $N$ vertices that have exactly $P$ perfect octopuses, modulo $998244353$.

Constraints

  • All inputs are integers.
  • $2 \leq N \leq 5 \times 10^5$
  • $0 \leq P \leq N$

Input

$N\ P$

Output

Print the answer in $1$ line.

Sample

Sample 1
Input
5 0
Output
5

With $5$ vertices and no perfect octopus, there is only the following $1$ shape of unlabeled octopus-cow tree, and there are $5$ ways to assign the labels.

Sample 2
Input
13 0
Output
48048000

With $13$ vertices and no perfect octopus, there are the following $2$ shapes of unlabeled octopus-cow trees.
The numbers of ways to assign the labels are $\frac{13!}{144}$ and $\frac{13!}{1296}$ respectively, for a total of $\frac{13! \cdot 10}{1296} = 48048000$ ways.

Sample 3
Input
133333 1333
Output
425602496

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。