#abc278d. D - All Assign Point Add
D - All Assign Point Add
Score : points
问题描述
你给定一个长度为 的序列 。
有 个查询,需要按顺序处理。第 个查询 属于以下三种格式之一,分别代表如下查询:
- : 将 赋值给 中的所有元素。
- : 向 中添加 。
- : 输出 的值。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
You are given a sequence of length .
Given queries, process all of them in order. The -th query is in one of the following three formats, which represents the following queries:
- : assign to every element of .
- : add to .
- : print the value of .
Constraints
- If the -th query is in the second or third format, .
- If the -th query is in the first or second format, .
- There exists a query in the third format.
- All values in the input are integers.
Input
The input is given from Standard Input in the following format:
Here, denotes the -th query, which is in one of following formats: 1 x
, 2 i x
, and 3 i
.
Output
Print lines, where is the number of 's such that is in the third format. The -th line should contain the answer to the -th such query.
Sample Input 1
5
3 1 4 1 5
6
3 2
2 3 4
3 3
1 1
2 3 4
3 3
Sample Output 1
1
8
5
Initially, . The queries are processed as follows:
- , so print .
- Add to , making .
- , so print .
- Assign to every element of , making .
- Add to , making .
- , so print .
Sample Input 2
1
1000000000
8
2 1 1000000000
2 1 1000000000
2 1 1000000000
2 1 1000000000
2 1 1000000000
2 1 1000000000
2 1 1000000000
3 1
Sample Output 2
8000000000
Note that the elements of may not fit into a -bit integer type.
Sample Input 3
10
1 8 4 15 7 5 7 5 8 0
20
2 7 0
3 7
3 8
1 7
3 3
2 4 4
2 4 9
2 10 5
1 10
2 4 2
1 10
2 3 1
2 8 11
2 3 14
2 1 9
3 8
3 8
3 1
2 6 5
3 7
Sample Output 3
7
5
7
21
21
19
10
update @ 2024/3/10 11:42:27