QOJ.ac

QOJ

Limite de temps : 4 s Limite de mémoire : 512 MB Points totaux : 100

#18784. 数列与查询 26

Statistiques

给定一个长度为 $N$ 的数列 $A_1, A_2, \ldots, A_N$。请编写程序处理以下查询:

  • 1 L R X:对于所有 $L \le i \le R$,执行 $A_i = \min(A_i, X)$。
  • 2 L R:输出 $\max(A_L, A_{L+1}, \ldots, A_R)$。
  • 3 L R:输出 $A_L + A_{L+1} + \ldots + A_R$。

输入格式

第一行包含数列的长度 $N$。($1 \le N \le 1{,}000{,}000$)

第二行包含 $A_1, A_2, \ldots, A_N$。($0 \le A_i < 2^{31}$)

第三行包含查询的个数 $M$。($1 \le M \le 1{,}000{,}000$)

接下来 $M$ 行,每行一个查询。($1 \le L \le R \le N$,$0 \le X < 2^{31}$)第 2 种和第 3 种查询至少出现一次。

输出格式

对于每个第 2 种和第 3 种查询,输出结果,每个结果占一行。

样例

样例输入 1

5
1 2 3 4 5
5
2 1 5
3 1 5
1 3 5 3
2 1 5
3 1 5

样例输出 1

5
15
3
12

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.