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

建议使用的浏览器:

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

6423:Rikka with Bubble Sort

题目描述
Bubble sort is a simple but beautiful algorithm. And this problem is a simple data structure task which is relative to bubble sort.

Rikka has an integer array $A$ of length $n$, and then she makes $m$ operations on it.

There are two types of operations:
1. 1 L R, Rikka runs the following C program on $A$.
for (int i=L;i<R;i++) if (A[i]>A[i+1]) swap(A[i], A[i+1]);
2. 2 L R, Rikka wants to know the interval sum of $[L,R]$, i.e., $\sum_{i=L}^R A_i$.
输入解释
The first line contains two integers $n,m(1 \leq n \leq 10^6, 1 \leq m \leq 3 \times 10^4)$, and the second line contains $n$ integers $A_i(1 \leq A_i \leq 10^9)$.

And then $m$ lines follow, each line contains three integers $t,L,R(t \in \{1,2\}, 1 \leq L \leq R \leq n)$.
输出解释
For each query, output a single line with a single integer, the answer.
输入样例
5 6
1 5 4 5 1
1 3 5
2 2 4
1 2 4 
2 1 3
1 1 5
2 3 4
输出样例
10
6
9
来自杭电HDUOJ的附加信息
Recommend chendu

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

源链接: HDU-6423

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

共提交 0

通过率 --%
时间上限 内存上限
30000/20000MS(Java/Others) 524288/524288K(Java/Others)