#P7482. 不条理狂诗曲
不条理狂诗曲
Description
YSGH has a non-negative integer sequence of length . Define as the maximum possible sum of some pairwise non-adjacent numbers chosen from the subarray of sequence .
YSGH wants to know $\displaystyle \left[ \sum_{l = 1}^{n} \sum_{r = l}^{n} f(l, r) \right] \bmod ({10}^9 + 7)$.
Input Format
The first line contains a positive integer , denoting the length of the sequence.
The second line contains non-negative integers .
Output Format
Only one line containing one integer, denoting the answer.
3
1 2 4
18
Hint
Sample Explanation
, , , , , .
The answer is .
Constraints
For of the testdata, , .
- Subtask 1 (10 points): .
- Subtask 2 (20 points): .
- Subtask 3 (20 points): .
- Subtask 4 (20 points): , where is an integer greater than .
- Subtask 5 (30 points): No special constraints.
Translated by ChatGPT 5
京公网安备 11011102002149号