#P8157. 「PMOI-5」肥宅快乐水
「PMOI-5」肥宅快乐水
Description
lhm has a polygon formed by rectangles of width arranged horizontally. The height of the -th rectangle is . Now he will perform operations. In each operation, the height of one rectangle of width is decreased by . After each operation, find the maximum area of a sub-rectangle (obviously, the sub-rectangle must be a continuous segment).
Note that in all cases, the height is always .
Since lhm is too weak, he wants to ask the smart you to help him solve it.
Input Format
The input has a total of lines.
The first line contains two integers , with meanings as described above.
The second line contains integers , where the -th integer represents the height of the -th rectangle.
The next lines each contain one integer . The operation index is $\operatorname{id}=\operatorname{id}'\bigoplus \operatorname{lastans}$, where is the answer to the previous query, and initially .
Output Format
The output has a total of lines.
Each line contains one integer, which is the required answer for each query.
5 2
2 3 1 3 2
2
6
5
4
Hint
This problem uses bundled testdata.
| Subtask ID | Score | |
|---|---|---|
| 1 | 10 | |
| 2 | ||
| 3 | 40 | |
| 4 |
For of the data, , . It is guaranteed that is within the range of long long.
Translated by ChatGPT 5
京公网安备 11011102002149号