201473: [AtCoder]ARC147 D - Sets Scores

Memory Limit:1024 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Score : $700$ points

Problem Statement

Consider a sequence of integer sets of length $N$: $S=(S_1,S_2,\dots,S_N)$. We call a sequence brilliant if it satisfies all of the following conditions:

  • $S_i$ is a (possibly empty) integer set, and its elements are in the range $[1,M]$. $(1 \le i \le N)$

  • The number of integers that is included in exactly one of $S_i$ and $S_{i+1}$ is $1$. $(1 \le i \le N-1)$

We define the score of a brilliant sequence $S$ as $\displaystyle \prod_{i=1}^{M}$ $($ the number of sets among $S_1,S_2,\dots,S_N$ that include $i$.$)$.

Find, modulo $998244353$, the sum of the scores of all possible brilliant sequences.

Constraints

  • $1 \le N,M \le 2 \times 10^5$
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

$N$ $M$

Output

Print the answer.


Sample Input 1

2 3

Sample Output 1

24

Among all possible brilliant sequences, the following $6$ have positive scores.

  • $S_1=\{1,2\},S_2=\{1,2,3\}$
  • $S_1=\{1,3\},S_2=\{1,2,3\}$
  • $S_1=\{2,3\},S_2=\{1,2,3\}$
  • $S_1=\{1,2,3\},S_2=\{1,2\}$
  • $S_1=\{1,2,3\},S_2=\{1,3\}$
  • $S_1=\{1,2,3\},S_2=\{2,3\}$

All of them have a score of $4$, so the sum of them is $24$.


Sample Input 2

12 34

Sample Output 2

786334067

Input

题意翻译

构造 $N$ 个集合,$S_1$ 到 $S_N$ 。 每个集合满足以下条件: + 每个元素是不大于 $M$ 的正整数; + 对于两个相邻的集合 $S_i$ 和 $S_{i+1}$,有且仅有一个数恰好在这两个集合中的一个里出现。 定义这 $N$ 个集合的分数为 $\prod\limits_{i=1}^m cnt(i)$ ,其中 $cnt(i)$ 为 $i$ 在所有 $N$ 个集合中出现的次数。 求所有满足条件的集合簇的分数之和,答案对 $998244353$ 取模。 $1\le N,M\le 2\times 10^5$ 。

加入题单

算法标签: