当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

5306:Gorgeous Sequence

题目描述
There is a sequence $a$ of length $n$. We use $a_i$ to denote the $i$-th element in this sequence. You should do the following three types of operations to this sequence.

$0\ x\ y\ t$: For every $x \le i \le y$, we use $min(a_i, t)$ to replace the original $a_i$'s value.
$1\ x\ y$: Print the maximum value of $a_i$ that $x \le i \le y$.
$2\ x\ y$: Print the sum of $a_i$ that $x \le i \le y$.
输入解释
The first line of the input is a single integer $T$, indicating the number of testcases.

The first line contains two integers $n$ and $m$ denoting the length of the sequence and the number of operations.

The second line contains $n$ separated integers $a_1, \ldots, a_n$ ($\forall 1 \le i \le n, 0 \le a_i < 2^{31}$).

Each of the following $m$ lines represents one operation ($1 \le x \le y \le n, 0\le t < 2^{31}$).

It is guaranteed that $T=100$, $\sum n \le 1000000, \ \sum m \le 1000000$.
输出解释
For every operation of type $1$ or $2$, print one line containing the answer to the corresponding query.
输入样例
1
5 5
1 2 3 4 5
1 1 5
2 1 5
0 3 5 3
1 1 5
2 1 5
输出样例
5
15
3
12

提示
Please use efficient IO method
来自杭电HDUOJ的附加信息
Author XJZX
Recommend wange2014

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-5306

最后修改于 2020-10-25T23:21:32+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
6000/3000MS(Java/Others) 131072/131072K(Java/Others)