#P5350. 序列
序列
Description
There is a sequence and several operations.
- : Find the sum from to .
- : Assign to through .
- : Add to through .
- : Copy through to the range through .
- : Swap through with through .
- : Reverse through .
Input Format
The first line contains two numbers and , the length of the sequence and the number of operations.
The second line contains numbers, which are .
The next lines each describe an operation type and several corresponding integers.
Output Format
Print several lines. For each operation of type , output the answer.
Since the answer may be too large, take it modulo .
On the last line, output the sequence . It should also be taken modulo.
10 10
7 1 3 2 2 4 0 1 2 2
4 10 10 3 3
3 4 10 5
6 6 7
6 9 10
1 10 10
5 9 10 6 7
2 8 10 0
5 4 4 5 5
5 2 4 8 10
3 3 9 0
7
7 0 0 0 7 7 7 1 2 7
Hint
Please pay attention to constant-factor optimizations.
For operations and , it is guaranteed that and the intervals do not overlap.
The testdata is guaranteed to be random.
For of the testdata, .
For of the testdata, .
For of the testdata, .
For of the testdata, ,。
Translated by ChatGPT 5
京公网安备 11011102002149号