#P6707. [COCI 2010/2011 #7] UPIT
[COCI 2010/2011 #7] UPIT
Description
Given a sequence , the following operations are supported.
Let the current length of the sequence be .
| Query type | Description |
|---|---|
1 A B X |
. |
2 A B X |
. |
3 C X |
, . |
4 A B |
Compute . |
Input Format
The first line contains two positive integers and , representing the initial length of the sequence and the number of operations.
The second line contains non-negative integers, representing the initial sequence.
The next lines each contain one query as described above.
Output Format
For each type operation, output one line with the answer.
5 5
1 2 3 4 5
1 5 5 0
4 4 5
4 5 5
2 1 5 1
4 1 5
4
0
25
1 7
100
3 1 17
3 2 27
3 4 37
4 1 1
4 2 2
4 3 3
4 4 4
17
27
100
37
Hint
Constraints
Let the current sequence length be .
For of the testdata: , , , , .
Notes
This problem is worth points in total.
Translated from COCI2010-2011 CONTEST #7 T6 UPIT.
Translated by ChatGPT 5
京公网安备 11011102002149号