luogu#P4146. 序列终结者
序列终结者
Background
There are many problems online where, given a sequence, you need to support several operations: A, B, C, D. Then you see another problem: again a sequence with operations to support: D, C, B, A. Especially someone here, when making a mock exam, even made one like this. Honestly, there is not much technical content in that...
So I will also make one. My goal is to let everyone have a “library” to rely on when solving such problems in the future, nothing else.
Let’s call this problem Sequence Terminator.
Problem Description
Given a sequence of length , each element is an integer (trivial). You need to support the following three operations:
- Add to every number in the interval .
- Reverse the interval , for example,
1 2 3 4becomes4 3 2 1. - Query the maximum value in the interval .
Initially, all elements are .
Input Format
The first line contains two integers . is the number of operations.
The next lines each contain up to four integers, in order: . indicates the operation type. If it is not the st operation, then only two numbers follow .
Output Format
For each operation of type , output the correct answer.
4 4
1 1 3 2
1 2 4 -1
2 1 3
3 2 4
2
Hint
,,。
Translated by ChatGPT 5