#P6856. 「EZEC-4.5」子序列
「EZEC-4.5」子序列
Description
Given a sequence with elements.
Define the value of a sequence with elements as:
$$\sum \limits _{i=1} ^ x s_i \times \prod \limits _{i=1} ^ x s_i$$Represent an -element subsequence of as , where is a strictly increasing sequence and .
Given an integer , define that an -element subsequence of is legal if it satisfies .
Compute, modulo , the sum of the values of all legal subsequences of .
Input Format
The first line contains three integers, .
The second line contains integers, .
Output Format
Output one integer, the answer modulo .
4 1 1000000007
1 2 3 4
150
3 2 114
2 3 4
65
12 8 10042020
1 1 4 5 1 4 1 9 1 9 8 10
2797740
Hint
Sample Explanation.
Sample 1.
-
All legal subsequences are $\{1\}, \{2\}, \{3\}, \{4\}, \{1,2\}, \{2,3\}, \{3,4\}$.
-
The answer is $1 \times 1 + 2 \times 2 + 3 \times 3 + 4 \times 4 + (1+2) \times 1 \times 2 + (2+3) \times 2 \times 3 + (3+4) \times 3 \times 4 = 150$.
Sample 2.
- All legal subsequences are $\{2\}, \{3\}, \{4\}, \{2,3\}, \{3,4\}, \{2,4\}, \{2,3,4\}$. The answer is .
Constraints.
| Test point ID | Special property | |
|---|---|---|
| None | ||
| None | ||
- For of the testdata, , , .
Translated by ChatGPT 5
京公网安备 11011102002149号