#ds203. 线段树打标记1
线段树打标记1
Segment Tree with Lazy Tag 1
Problem Description
You are given numbers .
You must support operations:
1 l r d: add to every with .2 l r: query .
Input Format
The first line contains two integers and ().
The next line contains integers ().
The following lines each describe an operation of the form 1 l r d or 2 l r, with and .
Output Format
For each query, output one line containing the answer.
Sample Input
5 5
1 2 3 4 5
2 4 5
1 1 5 1
2 1 4
1 2 3 10
2 2 4
Sample Output
5
5
14
Constraints
, , .