GCD Queries
The Greatest Common Divisor (GCD) of two integers,
You are given an array,
- print the GCD of the integers in
from index to index ( ), i.e. , where and are inclusive. - update any element within the array to a specified value
Input specification
The first line of input contains the integer
The next line contains a single integer
1 i j
- Print the Greatest Common Divisor of the integers in
from index to index - Constraints:
and
- Print the Greatest Common Divisor of the integers in
2 i x
- Update
to the value , i.e. set - Constraints:
and
- Update
Output specification
For each query which begins with
Example input
5
21 21 21 21 21
4
1 0 4
2 0 14
2 2 7
1 0 2
Example output
21
7
Notes
This problem has a lot of input and output. Please use fast input and output methods. Some tips are given here.
Comments
No judge available
I am getting a message saying, "No judge is available for this problem" when I go to submit my solution.
Edit: All fixed now! Thanks!