#P2710. 数列
数列
Description
Maintain a sequence with a total of operations:
I. INSERT x n a1 a2 .. an Insert numbers after the -th number.
II. DELETE x n Delete numbers starting from the -th number.
III. REVERSE x n Reverse the interval of numbers starting from the -th number.
IV. MAKE-SAME x n t Set the numbers starting from the -th number all to .
V. GET-SUM x n Output the sum of the numbers starting from the -th number.
VI. GET x Output the value of the -th number.
VII. MAX-SUM x n Output the maximum subarray sum within the numbers starting from the -th number.
Input Format
The first line contains , , where is the number of elements in the initial sequence, and is the number of operations.
The second line contains numbers , representing the initial sequence.
From the third line to line , each line contains one operation.
Output Format
Output the result of each GET-SUM, GET, and MAX-SUM operation.
9 8
2 -6 3 5 1 -5 -3 6 3
GET-SUM 5 4
MAX-SUM 1 9
INSERT 8 3 -5 7 2
DELETE 12 1
MAKE-SAME 3 3 2
REVERSE 3 6
GET 5
MAX-SUM 1 11
-1
10
-5
10
Hint
There are groups of testdata, each randomly generated.
It is guaranteed that at any time the sequence contains at most numbers.
Every input integer is in , and any result does not exceed .
Groups 1–2: , .
Groups 3–4: , .
Groups 5–6: , .
Groups 7–8: , .
Groups 9–10: , .
Groups 11–12: , .
Groups 13–14: , .
Groups 15–16: , .
Groups 17–18: , .
Groups 19–20: , .
Translated by ChatGPT 5
京公网安备 11011102002149号