Point Assign, Range GCD
Support U i v (assign ai = v) and Q l r (print the gcd of al..r).
Input: the first line has N and Q; the second line has the array; each of the next Q lines is an operation.
Output: one line per query.
Constraints:
- 1 ≤ N, Q ≤ 105
- 1 ≤ values ≤ 106
Sample Tests
Input 1
5 3 3 1 4 1 5 Q 1 5 U 2 9 Q 1 3
Output 1
1 1
Input 2
1 1 7 Q 1 1
Output 2
7
Discussion (opens after you solve — no spoilers before)
No comments yet.