#P10045. [CCPC 2023 北京市赛] 线段树

[CCPC 2023 北京市赛] 线段树

Problem Description

There is a sequence a1,a2,,ana_1,a_2,\cdots,a_n of length nn, and it is guaranteed that aia_i is odd.

There are two types of operations:

  1. Given l,r,xl, r, x, add the even number xx to al,al+1,,ara_l,a_{l+1},\cdots,a_r.

  2. Given l,rl, r, compute the product of al,al+1,,ara_l,a_{l+1},\cdots,a_r, and take the answer modulo 2202^{20}.

Input Format

The first line contains two positive integers n,qn, q, representing the length of the sequence and the number of queries. It is guaranteed that 1n,q2×1051 \le n, q \le 2 \times 10^5.

The second line contains nn odd integers a1,a2,,ana_1,a_2,\cdots,a_n. It is guaranteed that 1ai<2201 \le a_i < 2^{20}.

The next qq lines each describe one operation, in one of the following two formats:

  • 1 l r x1 ~ l ~ r ~ x: perform the first operation. It is guaranteed that 1lrn1 \le l \le r \le n, 0x<2200 \le x < 2^{20}.
  • 2 l r2 ~ l ~ r: perform the second operation. It is guaranteed that 1lrn1 \le l \le r \le n.

Output Format

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

10 10
969575 741825 24903 1047319 450475 256145 1045323 479255 810659 768323 
1 5 6 3034
2 1 10
2 1 9
2 1 4
1 3 6 126904
2 5 5
2 9 9
1 7 7 853094
1 4 9 1025178
2 5 8
1045541
1012343
558151
580413
810659
527353

Hint

Translated by ChatGPT 5