Title Description
Maintaining a series {a [i]}, supports two modes of operation:
1,1 LRKD: given a length equal to R-L + 1 arithmetic sequence, the first item is K, the tolerance is D, and each of which corresponds to the number of added a [L] ~ a [R] is. Namely: to make a [L] = a [L] + K, a [L + 1] = a [L + 1] + K + D,
a[L+2]=a[L+2]+K+2D……a[R]=a[R]+K+(R-L)D。
2,2 P: P challenge value of the sequence number of a [P].
Input Format
The first two rows integer n, m, represents the number of columns and the length of the number of operations.
The second line n integers, the i-th denotes a [i] (i = 1,2,3 ..., n).
The next row of m, m represents operations, there are two forms:
1 L R K D
2 P letter Meaning See description (L≤R).
Output Format
For each inquiry, output the answer, each answer per line.
SAMPLE INPUT
5 2 1 2 3 4 5 1 2 4 1 2 2 3Sample Output
6Description / Tips
Data Scale:
0≤n,m≤100000
|a[i]|,|K|,|D|≤200
We consider, for the period of the interval [ L , r ] [L, r], we only need to record its range of prime minister and tolerance, we will be able to pass this mark
QwQ wow, that you can only use the mark under a tree line pass (so no up function)
Click here to show pushdown portion
F [ R & lt O O T ] . D F [the root] 2.d represented tolerance, F [ R & lt O O T ] . F I R & lt S T F [the root] represents a prime .firstBecause the sum of arithmetic progression arithmetic sequence remains so for tolerance and prime minister, can be added directly
To a interval of the [ L , R & lt ] [L, R & lt], [ L , m I D ] [L, MID] This can partly be directly adder, and for [ m I D + . 1 , R & lt ] [MID +. 1, r] a little bit operations, the Prime Minister can modify
what sum, relatively simple
Boring columns
Guess you like
Origin www.cnblogs.com/Accpted/p/11313584.html
Ranking