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

建议使用的浏览器:

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

6087:Rikka with Sequence

题目描述
As we know, Rikka is poor at math. Yuta is worrying about this situation, so he gives Rikka some math tasks to practice. There is one of them:

Yuta has an array $A$ with $n$ numbers and he keeps a copy of the initial value of array $A$ as $A'(A'_i=A_i)$. Then he makes $m$ operations on it.

There are three types of operations:
$1\ l \ r$: Yuta wants Rikka to sum up $A_i$ for all $i$ in $[l,r]$.
$2 \ l\ r\ k$: Yuta runs the C++ code “for (int i=l;i<=r;i++) A[i]=A[i-k]” on sequence $A$. (The pascal version of the code snippet is “for i:=l to r do A[i]:=A[i-k]”).
$3\ l\ r$: Yuta changes $A_i$ back to $A'_i$, for all $i \in [l,r]$.

It is too difficult for Rikka. Can you help her?
输入解释
The first line contains two numbers $1 \leq n,m \leq 2 \times 10^5$.

The second line contains n numbers $A_i$. Then m lines follow, each line describe an operation.

It is guaranteed that $1 \leq k<l, 0 \leq A_i \leq 10^9$
输出解释
For each query, print a single line with a single number -- the answer.
输入样例
5 7
1 2 3 4 5
1 1 5
2 3 4 1
1 1 5
2 3 4 2
1 1 5
3 1 5
1 1 5
输出样例
15
12
11
15
来自杭电HDUOJ的附加信息
Recommend liuyiding

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

源链接: HDU-6087

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

共提交 0

通过率 --%
时间上限 内存上限
11000/5500MS(Java/Others) 65536/65536K(Java/Others)