#P10516. 数据结构
数据结构
Background
Little M likes data structures very much. Unfortunately, he did not make it into the NOI Qualifier team.
Everyone has dreams, and everyone has their own wonderful life.
Problem Description
Given two sequences and of length . There are three types of operations:
- Given an interval and parameters , for each position in the interval that satisfies , add to and add to .
- Given and , set to , and set to .
- Query the sum of over all positions in the interval.
Input Format
The first line contains two integers , representing the number of elements in the sequences and the total number of operations.
The second line contains integers separated by spaces; the -th integer is .
The third line contains integers separated by spaces; the -th integer is .
The next lines each contain to integers, describing one operation as follows:
1 l r k t: perform Operation 1 on interval .2 i x y: set to , and set to .3 l r: output the sum over the interval .
Output Format
Output several lines, each being the answer to an Operation 3 query.
5 5
23 4 3 3 7
54 29 7 1 2
1 1 5 114 1
2 2 7 9
3 1 5
3 1 2
3 3 4
122
93
18
Hint
[Sample Explanation]
After the first modification, the sequence is: ; the sequence is .
After the second modification, the sequence is: ; the sequence is .
[Constraints]
- For of the testdata, .
- For of the testdata, .
- For of the testdata, .
- For another of the testdata, there are no Operations 1 and 2.
- For another of the testdata, there is no Operation 1.
- For another of the testdata, there is no Operation 2.
For all testdata, , .
Translated by ChatGPT 5