|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|2 초||256 MB||29||9||7||38.889%|
Please write a program that maintains a sequence, supporting the following 6 operations:
||After the posi-th number in the current sequence, insert a total of tot numbers: c1, c2, …, ctot. Insertion to the beginning of the sequence will have posi equal to 0.|
||Starting at the posi-th number in the current sequence, delete a total of tot consecutive numbers.|
||Starting at the posi-th number in the current sequence, change all the values of tot consecutive numbers to c.|
||Starting at the posi-th number in the current sequence, reverse the order of tot consecutive numbers.|
|5. Get Sum||
||Starting at the posi-th number in the current sequence, output the sum of tot consecutive numbers.|
|6. Max Sum||
||Output the largest sum of any (non-empty) consecutive subsequence of the current sequence.|
The first line of input contains two integers N and M, where N is the initial length of the sequence and M is the number of operations.
The second line of input contains N integers, describing the initial sequence.
For the next M lines, each line will contain a command in one of the formats described above.
MAX-SUM operation in the input, output the result of the query on a separate line.
9 8 2 -6 3 5 1 -5 -3 6 3 GET-SUM 5 4 MAX-SUM INSERT 8 3 -5 7 2 DELETE 12 1 MAKE-SAME 3 3 2 REVERSE 3 6 GET-SUM 5 4 MAX-SUM
-1 10 1 10