QOJ.ac

QOJ

Time Limit: 4 s Memory Limit: 1024 MB Total points: 100

#7992. 【模板】线段树

الإحصائيات

题目描述

有一个长度为 $n$ 的序列 $a_1,a_2,\cdots,a_n$,保证 $a_i$ 为奇数

有两种操作:

  1. 给定 $l,r,x$,将 $a_l,a_{l+1},\cdots,a_r$ 加上偶数 $x$;
  2. 给定 $l,r$,求 $a_l,a_{l+1},\cdots,a_r$ 的乘积,答案对 $2^{20}$ 取模;

输入格式

从标准输入读入数据。

第一行两个正整数 $n,q$ 表示序列的长度和询问的个数. 保证 $1 \le n,q \le 2\times 10^5$。

第二行 $n$ 个奇数 $a_1,a_2,\cdots,a_n$. 保证 $1 \le a_i < 2^{20}$。

接下来 $q$ 行,每一行表示一个操作,格式为以下两种之一:

  • $1 ~ l ~ r ~ x$:表示进行第一种操作. 保证 $1 \le l \le r \le n$,$0 \le x < 2 ^ {20}$。
  • $2 ~ l ~ r$:表示进行第二种操作. 保证 $1 \le l \le r \le n$。

输出格式

输出到标准输出。

对于每一次 $2$ 操作,输出一行一个整数表示答案。

样例

输入

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
About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.