#P15773. [JAG 2025 Summer Camp #2] Count Unique Packing

[JAG 2025 Summer Camp #2] Count Unique Packing

题目描述

You work at the Identifiability in Container Packing Center, where you research the uniqueness of container packings.

You are given NN items. Item ii has a positive integer weight AiA_i (1iN1 \leq i \leq N).

You consider packing a (nonempty) subset S{1,2,,N}S \subseteq \{1, 2, \ldots, N\} of the items into containers. You may use any number of nonempty containers (empty containers are not allowed). Fix a positive integer ww denoting the capacity of each container. A valid packing of SS is an assignment of the items in SS to containers that satisfies all of the following:

  • Cover: Every item in SS is placed in exactly one container.
  • Capacity: In each container, the total weight of its items is at most ww.
  • Non-mergeability: For any two distinct containers AA and BB, the total weights of the items contained in AA or BB is strictly greater than ww (i.e., no two containers can be merged into a single container without violating capacity ww).

Containers are indistinguishable and items are distinct even if some have the same weight. Two packings are considered the same if and only if they induce the same partition of SS; equivalently, for any distinct i,jSi, j \in S, items ii and jj are in the same box in one packing if and only if they are in the same box in the other.

For a fixed ww, call a subset SS uniquely packable if there is exactly one valid packing of SS that satisfies all conditions.

You are given an integer WW. Let f(w)f(w) (w=1,2,,Ww = 1, 2, \ldots, W) be the number of uniquely packable nonempty subsets for capacity ww. For each w=1,2,,Ww = 1, 2, \ldots, W, output f(w)f(w) modulo 998244353998244353. In other words, for each w=1,2,,Ww = 1, 2, \ldots, W, define

$$f(w) = \#\{S \subseteq \{1, 2, \ldots, N\} \mid S \text{ is nonempty and uniquely packable for capacity } w\}. $$

Output WW integers; for each w=1,2,,Ww = 1, 2, \ldots, W, print f(w)f(w) modulo 998244353998244353.

输入格式

The input consists of a single test case of the following format.

$$\begin{aligned} & N \ W \\ & A_1 \ A_2 \ \cdots \ A_N \end{aligned} $$

The first line contains two integers NN (1N50001 \leq N \leq 5000) representing the number of items and WW (1W50001 \leq W \leq 5000) representing upper bound on the capacity parameter ww (i.e., the maximum capacity to consider). The second line contains NN positive integers A1,A2,,ANA_1, A_2, \ldots, A_N (1AiW1 \leq A_i \leq W). Each AiA_i represents the weight of the item ii.

输出格式

Output WW integers in a single line separated by spaces: for each w=1,2,,Ww = 1, 2, \ldots, W, the ww-th integer is f(w)f(w) modulo 998244353998244353 (the answer for capacity ww).

4 4
1 3 2 4
1 3 7 13
3 9
9 1 4
1 1 1 3 3 3 3 3 7
2 2
2 2
0 3