#P10639. BZOJ4695 最假女选手

    ID: 12113 远端评测题 2000ms 512MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>线段树吉司机线段树 segment tree beats

BZOJ4695 最假女选手

Problem Description

Given a sequence of length nn, you need to support the following 66 operations:

  • Add an integer xx to an interval [l,r][l,r].
  • In an interval [l,r][l,r], change all numbers less than xx into xx.
  • In an interval [l,r][l,r], change all numbers greater than xx into xx.
  • Query the sum of an interval [l,r][l,r].
  • Query the maximum value of an interval [l,r][l,r].
  • Query the minimum value of an interval [l,r][l,r].

Input Format

The first line contains an integer nn, which is the length of the sequence.

The second line contains nn integers aia_i, which represent the initial sequence.

The third line contains an integer mm, which is the number of operations.

The next mm lines each contain three or four integers, representing one operation described above.

Output Format

For each operation of type 4,5,64,5,6, output one line with one integer representing the answer.

2
1 2
2
2 1 2 2
4 1 2
4

Hint

Constraints: 1n,m5×1051\leq n,m\leq 5\times 10^5, ai108|a_i|\leq 10^8.

When performing operation 11, x1000|x| \leq 1000.

When performing operation 22, x108|x| \leq 10^8.

Translated by ChatGPT 5