#P4389. 付公主的背包

    ID: 3255 远端评测题 1000ms 500MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>数学O2优化背包生成函数快速傅里叶变换 FFT

付公主的背包

Description

This backpack can hold a total size of at most 10510^5.

Princess Fu has nn types of goods and she is about to set up a stall.

Each type has volume viv_i, and there are infinitely many pieces available.

Given mm, for s[1,m]s \in [1,m], please answer the number of ways to fill exactly volume ss using these goods.

Input Format

The first line contains two positive integers n,mn, m. The second line contains nn positive integers, representing the volume of each type of good.

Output Format

Output mm lines, where the ii-th line represents the number of ways when s=is = i, taken modulo 998244353998244353.

2 4
1 2
1
2
2
3

Hint

Constraints
For 30% of the testdata, 1n,m30001 \le n, m \le 3000.
For 60% of the testdata, purely randomly generated.
For 100% of the testdata, 1n,m1051 \le n, m \le 10^5, 1vim1 \le v_i \le m.

Translated by ChatGPT 5