Description
You have N integers, A1, A2, ... ,AN. You need to deal with two kinds of operations. One type of operation is to add some given number to each number in a given interval. The other is to ask for the sum of numbers in a given interval.
Input
The first line contains two numbers N and Q. 1 ≤ N,Q ≤ 100000.
The second line contains N numbers, the initial values of A1,A2, ... , AN. -1000000000 ≤ Ai ≤ 1000000000.
Each of the next Q lines represents an ope
这篇博客介绍了一个处理区间内整数加法和求和操作的问题,具体包括两个类型的指令:一种是将特定数值加到指定区间内的每个数上,另一种是查询指定区间的数之和。输入包含初始整数数组和操作指令,输出是根据指令计算后的结果。
订阅专栏 解锁全文
2916

被折叠的 条评论
为什么被折叠?



