#P3747. [六省联考 2017] 相逢是问候
[六省联考 2017] 相逢是问候
Description
Informatik verbindet dich und mich.
Information connects you and me.
Mr. B wants to maintain an array of length , whose indices are the positive integers from to .
There are operations, of two types:
-
0 l rmeans: for each number among the -th to the -th numbers (), replace with , i.e., assign , where is a given constant in the input. -
1 l rasks for the sum of the -th to the -th numbers, i.e., output .
Because the result can be very large, you only need to output the result .
Input Format
The first line contains four integers , whose meanings are given in the problem statement.
The next line contains integers, the initial values of the array .
The next lines each contain three integers; the first integer indicates the type of operation.
- If it is
0, this is an update operation with parameters . - If it is
1, this is a query operation with parameters .
Output Format
For each query operation, output one line with a single integer: the answer .
4 4 7 2
1 2 3 4
0 1 4
1 2 4
0 1 4
1 1 3
0
3
1 40 19910626 2
0
0 1 1
1 1 1
0 1 1
1 1 1
0 1 1
1 1 1
0 1 1
1 1 1
0 1 1
1 1 1
0 1 1
1 1 1
0 1 1
1 1 1
0 1 1
1 1 1
0 1 1
1 1 1
0 1 1
1 1 1
0 1 1
1 1 1
0 1 1
1 1 1
0 1 1
1 1 1
0 1 1
1 1 1
0 1 1
1 1 1
0 1 1
1 1 1
0 1 1
1 1 1
0 1 1
1 1 1
0 1 1
1 1 1
0 1 1
1 1 1
1
2
4
16
65536
11418102
18325590
13700558
13700558
13700558
13700558
13700558
13700558
13700558
13700558
13700558
13700558
13700558
13700558
13700558
Hint
Constraints
- For of the test points, identical to the sample.
- For another of the test points, there are no updates.
- For another of the test points, each update modifies only one position (i.e., ), and each position is updated at most once.
- For another of the test points, .
- For another of the test points, .
- For another of the test points, .
- For another of the test points, .
- For of the test points, , , , .
Translated by ChatGPT 5
京公网安备 11011102002149号