#P10463. Interval GCD
Interval GCD
Problem Description
Given an array of length and instructions, each instruction is one of the following two types:
C l r d, meaning to add to all of .Q l r, meaning to query the greatest common divisor () of .
For each query, output one integer as the answer.
Input Format
The first line contains two integers .
The second line contains integers, representing .
The next lines describe the instructions. The format of each instruction is the same as in the description.
Output Format
For each query, output one integer as the answer, one per line.
5 5
1 3 5 7 9
Q 1 5
C 1 5 1
Q 1 5
C 3 3 6
Q 2 4
1
2
4
Hint
For of the testdata: , , , . It is guaranteed that during computation, the values will not exceed the range of long long.
Translated by ChatGPT 5