#P7961. [NOIP2021] 数列

    ID: 9048 远端评测题 1000ms 512MiB 尝试: 0 已通过: 0 难度: 7 上传者: 标签>动态规划 DP2021NOIP 提高组O2优化排列组合

[NOIP2021] 数列

Problem Description

You are given integers n,m,kn, m, k, and a positive integer array v0,v1,,vmv_0, v_1, \ldots, v_m of length m+1m + 1.

For a non-negative integer sequence {ai}\{a_i\} of length nn (indexed from 11) where each element is at most mm, we define its weight as $v_{a_1} \times v_{a_2} \times \cdots \times v_{a_n}$.

If such a sequence {ai}\{a_i\} satisfies that, in the binary representation of the integer S=2a1+2a2++2anS = 2^{a_1} + 2^{a_2} + \cdots + 2^{a_n}, the number of 11 bits is at most kk, then we call {ai}\{a_i\} a valid sequence.

Compute the sum of weights of all valid sequences {ai}\{a_i\} modulo 998244353998244353.

Input Format

The first line contains three integers n,m,kn, m, k.

The second line contains m+1m + 1 integers: v0,v1,,vmv_0, v_1, \ldots, v_m.

Output Format

Output a single integer, representing the sum of weights of all valid sequences modulo 998244353998244353.

5 1 1
2 1

40

见附件中的 sequence/sequence2.in
见附件中的 sequence/sequence2.ans

Hint

[Sample Explanation #1]

Since k=1k = 1, and from nSn×2mn \leq S \leq n \times 2^m we know 5S105 \leq S \leq 10, there is only one possible valid SS: S=8S = 8. This requires that aa must contain 22 zeros and 33 ones. Therefore, there are (52)=10\binom{5}{2} = 10 possible sequences. Each sequence contributes v02v13=4v_0^2 v_1^3 = 4, so the sum of weights is 10×4=4010 \times 4 = 40.

[Constraints]

For all testdata, it is guaranteed that 1kn301 \leq k \leq n \leq 30, 0m1000 \leq m \leq 100, and 1vi<9982443531 \leq v_i < 998244353.

::cute-table{tuack}

Test Point nn kk mm
141 \sim 4 =8=8 n\leq n =9=9
575 \sim 7 =30=30 ^ =7=7
8108 \sim 10 ^ =12=12
111311 \sim 13 =1=1 =100=100
141514 \sim 15 =5=5 n\leq n =50=50
1616 =15=15 ^ =100=100
171817 \sim 18 =30=30 =30=30
192019 \sim 20 ^ =100=100

Translated by ChatGPT 5