4904. RSQ and RUQ
时间限制:1000 MS 内存限制:256 MB
题目描述
## 题目描述 Write a program which manipulates a sequence AA = {a0,a1,...,an-1a0,a1,...,an-1} with the following operations: - update(s,t,x)update(s,t,x): change as,as+1,...,atas,as+1,...,at to xx. - getSum(s,t)getSum(s,t): print the sum of as,as+1,...,atas,as+1,...,at. Note that the initial values of ai(i=0,1,...,n-1)ai(i=0,1,...,n-1) are 0. ```in2 nn qq query1query1 query2query2 : queryqqueryq ``` In the first line, nn (the number of elements in AA) and qq (the number of queries) are given. Then, ii-th query queryiqueryi is given in the following format: ``` 0 ss tt xx ``` or ``` 1 ss tt ``` The first digit represents the type of the query. '0' denotes update(s,t,x)update(s,t,x) and '1' denotes find(s,t)find(s,t). ## 输出格式 For each getSumgetSum query, print the sum in a line. ## 数据范围 - 1\len\le1000001\len\le100000 - 1\leq\le1000001\leq\le100000 - 0\les\let<n0\les\let<n - -1000\lex\le1000-1000\lex\le1000 ## 输入 ## 输入 ```in1 6 7 0 1 3 1 0 2 4 -2 1 0 5 1 0 1 0 3 5 3 1 3 4 1 0 5 ``` ## 输出 ```out1 -5 1 6 8 ```