#P5610. [Ynoi2013] 大学

[Ynoi2013] 大学

Problem Description

Given a non-negative integer sequence aa of length nn, support the following two operations:

  • 1 l r x: For all numbers in the interval [l,r][l,r] that are multiples of xx, divide them by xx.
  • 2 l r: Query the sum of the interval [l,r][l,r].

This problem is forced online. For each operation, the values l,r,xl, r, x need to be XORed with the previous answer. If there has been no previous query, then the previous answer is 00.

Input Format

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

The second line contains nn non-negative integers representing aia_i.

Then follow mm lines, each describing one operation.

  • 1 l r x: For all numbers in the interval [l,r][l,r] that are multiples of xx, divide them by xx.
  • 2 l r: Query the sum of the interval [l,r][l,r].

Output Format

For each query, output one integer per line as the answer.

5 2
1 2 3 4 5
1 1 5 2
2 1 5
12

Hint

Constraints: 1n,m1051\leq n,m\leq 10^5, 0ai5×1050\leq a_i\leq 5\times 10^5. The decrypted x,l,rx,l,r satisfy 1x5×1051\leq x\leq 5\times 10^5, 1lrn1\leq l\leq r\leq n.

Idea: nzhtl1477, Solution: nzhtl1477, Code: nzhtl1477, mrsrz, Data: nzhtl1477, mrsrz, 一只绝帆.

Translated by ChatGPT 5