#P3328. [SDOI2015] 音质检测
[SDOI2015] 音质检测
Description
Boss Wan wants to implement an evaluation of the audio quality performance of wave files in the new smart music player . A discrete wave file is considered as an integer sequence of length : . The audio quality evaluation can be computed for any interval , and the score depends on the following expression:
$$\sum_{L<i<R}F[A_{i-1}+1]F[A_{i+1}-1] \operatorname{mod}\;(10^9+7)$$Here is an inductively defined sequence, satisfying , , and for any .
Here and are non-negative integer coefficients. To provide a better user experience and to allow optimization of the given wave file, the device should also support modifications to the wave file. For a given interval , the user is allowed to increase through by one simultaneously, or decrease them by one simultaneously.
Input Format
The first line contains two positive integers: the total length of the wave file, and the total number of modifications and queries.
The second line contains two integers, the coefficients and .
Then, over several lines, positive integers through are given, satisfying .
Then follow lines, each in one of the following three forms:
- increase every element with index in by one.
- decrease every element with index in by one.
- ask for the audio quality score of the interval . In both modifications and queries, it is guaranteed that , and that is strictly greater than the total number of modifications plus one (modification operations include both and ).
Output Format
Output several lines, each corresponding to one query. For each query, output one integer.
7 7
1 0
3 4 5 6 7 8 9
query 2 4
query 3 7
plus 3 5
query 2 4
plus 4 7
query 3 7
query 1 7
64
1766
104
7479
7687
Hint
.
Translated by ChatGPT 5
京公网安备 11011102002149号