#P9989. [Ynoi Easy Round 2023] TEST_69

[Ynoi Easy Round 2023] TEST_69

Problem Description

Given a sequence aa of length nn, there are mm operations.

Each time, there are two types of operations:

1 l r x: For all ii in the interval [l,r][l,r], set aia_i to gcd(ai,x)\gcd(a_i,x).

2 l r: Query the sum of the interval [l,r][l,r], and output the answer modulo 2322^{32}.

Input Format

The first line contains two integers n,mn,m.

The second line contains nn integers representing aia_i.

Then follow mm lines, each containing three or four integers, describing one operation.

Output Format

For each operation of type 22, output one line with one integer representing the answer to this query.

10 10
4 1 5 10 1 3 8 2 8 2 
2 1 7
2 1 10
1 7 10 4
1 5 8 10
2 1 8
1 3 5 2
1 3 4 3
2 5 8
2 3 7
2 6 10
32
44
26
6
6
11

Hint

Idea: nzhtl1477, Solution: nhtl1477, Code: ccz181078, Data: ccz181078.

For 20%20\% of the testdata, 1n,m,ai,x1031 \le n,m,a_i,x \le 10^3.

For 50%50\% of the testdata, 1n,m1051 \le n,m \le 10^5, and the elements in aa and the xx in each operation are generated randomly.

For another 20%20\% of the testdata, all queries happen after modifications.

For 100%100\% of the testdata, 1n21051 \le n \le 2 \cdot 10^5, 1m51051 \le m \le 5 \cdot 10^5, and all values are integers in [1,1018][1,10^{18}].

Translated by ChatGPT 5