luogu#P4891. 序列
序列
Background
The testdata for this problem has been updated.
Problem Description
Given two sequences and of length , define the sequence .
Define the current value as .
Now there are operations. Each operation modifies one position in sequence or , and the number will increase. You need to output the value after each modification.
Input Format
The first line contains two integers .
The second line contains integers representing .
The third line contains integers representing .
The next lines each contain three integers . If , it means an operation on sequence ; if , it means an operation on sequence . Set the -th element of the corresponding sequence to . It is guaranteed that is not smaller than the original element.
Output Format
Output lines, each being the value after the corresponding modification.
Since the answer can be very large, output it modulo .
3 1
2 1 3
1 2 3
1 3 5
6
Hint
For all testdata, .
For 20% of the Constraints, .
For another 10% of the Constraints, .
For another 20% of the Constraints, .
For 80% of the Constraints, .
Translated by ChatGPT 5