#P4146. 序列终结者

序列终结者

Description

Given a sequence of length NN, each element is an integer (trivial). You need to support the following three operations:

  1. Add VV to every number in the interval [L,R][L,R].
  2. Reverse the interval [L,R][L,R], for example, 1 2 3 4 becomes 4 3 2 1.
  3. Query the maximum value in the interval [L,R][L,R].

Initially, all elements are 00.

Input Format

The first line contains two integers NMN,M. MM is the number of operations.

The next MM lines each contain up to four integers, in order: KLRVK,L,R,V. KK indicates the operation type. If it is not the 11st operation, then only two numbers follow KK.

Output Format

For each operation of type 33, output the correct answer.

4 4
1 1 3 2
1 2 4 -1
2 1 3
3 2 4
2

Hint

1N500001\le N \le 500001M1000001\le M \le 100000V1000|V| \leq 1000

Translated by ChatGPT 5