CF1866H.Happy Sets

提高+/省选-

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Define a set AA as a child of set BB if and only if for each element of value xx that is in AA, there exists an element of value x+1x+1 that is in BB.

Given integers NN and KK. In order to make Chaneka happy, you must find the number of different arrays containing NN sets [S1,S2,S3,…,SN][S_1, S_2, S_3, \ldots, S_N] such that: - Each set can only contain zero or more different integers from 11 to KK. - There exists a way to rearrange the order of the array of sets into [S1′,S2′,S3′,…,SN′][S'_1, S'_2, S'_3, \ldots, S'_N] such that Si′S'_i is a child of Si+1′S'_{i+1} for each 1≤i≤N−11\leq i\leq N-1.

Print the answer modulo 998 244 353998\,244\,353.

Two sets are considered different if and only if there is at least one value that only occurs in one of the two sets.

Two arrays of sets are considered different if and only if there is at least one index ii such that the sets at index ii in the two arrays are different.

定义集合 AA 是集合 BB 的子集(child),当且仅当:对任意元素 x∈Ax \in A,均有 x+1∈Bx+1 \in B。

给定整数 NN 和 KK。为使 Chaneka 开心,你需要计算满足以下条件的、由 NN 个集合组成的数组 [S1,S2,S3,…,SN][S_1, S_2, S_3, \ldots, S_N] 的不同方案数:

  • 每个集合 SiS_i 只能包含 11 到 KK 范围内的若干互不相同的整数(允许为空集);
  • 存在一种将该集合数组重排为 [S1′,S2′,S3′,…,SN′][S'_1, S'_2, S'_3, \ldots, S'_N] 的方式,使得对每个 1≤i≤N−11 \leq i \leq N-1,均有 Si′S'_i 是 Si+1′S'_{i+1} 的子集(child)。

输出答案对 998 244 353998\,244\,353 取模的结果。

两个集合被视为不同,当且仅当存在至少一个整数,它仅属于其中某一个集合。

两个集合数组被视为不同,当且仅当存在至少一个下标 ii,使得这两个数组在第 ii 个位置上的集合不同。

输入格式

The only line contains two integers NN and KK (1≤N,K≤2⋅1051 \leq N,K \leq 2\cdot10^5) — the number of sets in the array and the maximum limit for the values in the sets.

唯一一行包含两个整数 NN 和 KK(1≤N,K≤2⋅1051 \leq N,K \leq 2\cdot10^5)—— 分别表示数组中集合的数量以及集合中元素值的最大限制。

输出格式

An integer representing the number of different arrays of sets that satisfy the problem condition, modulo 998 244 353998\,244\,353.

一个整数,表示满足题目条件的不同集合数组的个数,对 998 244 353998\,244\,353 取模。

输入输出样例

  • 输入#1

    2 2

    输出#1

    11
  • 输入#2

    1 3

    输出#2

    8
  • 输入#3

    3 1

    输出#3

    4

说明/提示

In the first example, there are 1111 different arrays of sets possible, which are:

  • [,][{}, {}]
  • [,1][{}, {1}]
  • [,1,2][{}, {1, 2}]
  • [,2][{}, {2}]
  • [1,][{1}, {}]
  • [1,1,2][{1}, {1, 2}]
  • [1,2][{1}, {2}]
  • [1,2,][{1, 2}, {}]
  • [1,2,1][{1, 2}, {1}]
  • [2,][{2}, {}]
  • [2,1][{2}, {1}]

在第一个例子中,共有 1111 种不同的集合数组,它们是:

  • [,][{}, {}]
  • [,1][{}, {1}]
  • [,1,2][{}, {1, 2}]
  • [,2][{}, {2}]
  • [1,][{1}, {}]
  • [1,1,2][{1}, {1, 2}]
  • [1,2][{1}, {2}]
  • [1,2,][{1, 2}, {}]
  • [1,2,1][{1, 2}, {1}]
  • [2,][{2}, {}]
  • [2,1][{2}, {1}]

输入解题思路,AI测评打分。不知道怎么写?

首页