P3328 [SDOI2015] Audio Quality Detection
Description
Boss Wan wants to implement an evaluation of the audio quality performance of wave files in the new smart music player $\operatorname{IPOOD}$. A discrete wave file is considered as an integer sequence of length $N$: $A_1, A_2, \cdots, A_N$. The audio quality evaluation can be computed for any interval $[L, R]$, and the score depends on the following expression:
$$\sum_{L
Input Format
The first line contains two positive integers: the total length $N$ of the wave file, and the total number $Q$ of modifications and queries.
The second line contains two integers, the coefficients $a$ and $b$.
Then, over several lines, $N$ positive integers $A_1$ through $A_N$ are given, satisfying $1 \leq A_i \leq 2 \times 10^9$.
Then follow $Q$ lines, each in one of the following three forms:
- $\text{plus}\;L\;R:$ increase every element with index in $[L, R]$ by one.
- $\text{minus}\;L\;R:$ decrease every element with index in $[L, R]$ by one.
- $\text{query}\;L\;R:$ ask for the audio quality score of the interval $[L, R]$. In both modifications and queries, it is guaranteed that $L \leq R$, and that $A_i$ is strictly greater than the total number of modifications plus one (modification operations include both $\text{plus}$ and $\text{minus}$).
Output Format
Output several lines, each corresponding to one query. For each query, output one integer.
Explanation/Hint
$N\leq 3\times10^5,Q\leq10^4,0\leq a,b\leq10^9$.
Translated by ChatGPT 5