#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 items. Item has a positive integer weight ().
You consider packing a (nonempty) subset of the items into containers. You may use any number of nonempty containers (empty containers are not allowed). Fix a positive integer denoting the capacity of each container. A valid packing of is an assignment of the items in to containers that satisfies all of the following:
- Cover: Every item in is placed in exactly one container.
- Capacity: In each container, the total weight of its items is at most .
- Non-mergeability: For any two distinct containers and , the total weights of the items contained in or is strictly greater than (i.e., no two containers can be merged into a single container without violating capacity ).
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 ; equivalently, for any distinct , items and are in the same box in one packing if and only if they are in the same box in the other.
For a fixed , call a subset uniquely packable if there is exactly one valid packing of that satisfies all conditions.
You are given an integer . Let () be the number of uniquely packable nonempty subsets for capacity . For each , output modulo . In other words, for each , define
$$f(w) = \#\{S \subseteq \{1, 2, \ldots, N\} \mid S \text{ is nonempty and uniquely packable for capacity } w\}. $$Output integers; for each , print modulo .
输入格式
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 () representing the number of items and () representing upper bound on the capacity parameter (i.e., the maximum capacity to consider). The second line contains positive integers (). Each represents the weight of the item .
输出格式
Output integers in a single line separated by spaces: for each , the -th integer is modulo (the answer for capacity ).
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