atcoder#ABC278D. [ABC278D] All Assign Point Add
[ABC278D] All Assign Point Add
Score : points
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.
5
3 1 4 1 5
6
3 2
2 3 4
3 3
1 1
2 3 4
3 3
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 .
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
8000000000
Note that the elements of may not fit into a -bit integer type.
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
7
5
7
21
21
19
10