#P10045. [CCPC 2023 北京市赛] 线段树
[CCPC 2023 北京市赛] 线段树
Problem Description
There is a sequence of length , and it is guaranteed that is odd.
There are two types of operations:
-
Given , add the even number to .
-
Given , compute the product of , and take the answer modulo .
Input Format
The first line contains two positive integers , representing the length of the sequence and the number of queries. It is guaranteed that .
The second line contains odd integers . It is guaranteed that .
The next lines each describe one operation, in one of the following two formats:
- : perform the first operation. It is guaranteed that , .
- : perform the second operation. It is guaranteed that .
Output Format
For each operation of type , output one line with one integer representing the answer.
10 10
969575 741825 24903 1047319 450475 256145 1045323 479255 810659 768323
1 5 6 3034
2 1 10
2 1 9
2 1 4
1 3 6 126904
2 5 5
2 9 9
1 7 7 853094
1 4 9 1025178
2 5 8
1045541
1012343
558151
580413
810659
527353
Hint
Translated by ChatGPT 5