QOJ.ac

QOJ

Time Limit: 6 s Memory Limit: 512 MB Total points: 100

#13788. 堕天作战 TEST_98

الإحصائيات

给定一个长为 $n$ 的序列 $a$,有两种操作,共 $m$ 次:

  1. 给定 $l$ $r$ $x$,对于所有 $i$ 满足 $l\le i\le r$ 且 $a_i \neq x$,$a_i\leftarrow a_i-x$。
  2. 给定 $l$ $r$,求对于所有 $i$ 满足 $l\le i\le r$ 且 $a_i\neq 0$,$a_i$ 的和。

输入格式

第一行两个数 $n,m$。

第二行 $n$ 个用空格隔开的数表示序列 $a$。

之后 $m$ 行,每行三个或四个数:

若输入为 1 l r x,则表示对区间 $[l,r]$ 进行一次 $1$ 操作,若输入为 2 l r,则表示对区间 $[l,r]$ 进行一次 $2$ 操作。

本题强制在线,所有输入的 $l,r,x$ 均需要异或 $lastans$,其定义为上一次询问操作得到的答案对 $2^{20}$ 取模后的值,若之前没有询问操作,则为 $0$。

输出格式

对每个 $2$ 操作,输出一行一个数表示答案对 $2^{64}$ 取模后的结果。

样例数据

样例 1 输入

10 10
0 1 2 3 4 5 6 7 8 9
1 5 10 5
2 1 10
1 23 29 23
2 21 19
1 1048573 1048570 1048574
2 1048573 1048566
1 1048573 1048569 1048575
2 1048575 1048564
1 1048572 1048567 1048572
2 1048572 1048567

样例 1 输出

20
18446744073709551615
18446744073709551614
18446744073709551613
18446744073709551606

子任务

Idea:nzhtl1477,Solution:nzhtl1477,Code:w33z8kqrqk8zzzx33,Data:w33z8kqrqk8zzzx33

对于 $5\%$ 的数据,$n,m\le 1000$。

对于 $30\%$ 的数据,$n,m\le 5\times10^4$。

对于另外 $20\%$ 的数据,$l=1,r=n$。

对于另外 $20\%$ 的数据,$x=1$。

对于 $100\%$ 的数据 $1\le n,m \le 5\times10^5, 0\le a_i, x \le10^9$。

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.