QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 2048 MB Total points: 100

#8899. TEST_100

Statistics

给定一个长为 $n$ 的序列 $a$,每个位置是一个变换 $x=|x-a_i|$,每次查询给出一个区间 $[l,r]$ 和一个值 $v$,依次令 $i$ 从 $l$ 到 $r$ ,访问每个元素 $a_i$,将 $v$ 变为 $|v-a_i|$,求结束后的 $v$ 的值。

输入格式

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

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

之后 $m$ 行,每行三个用空格隔开的数 $l,r,v$ 表示一次询问。

本题强制在线,所有输入的 $l,r,v$ 均需要异或上次询问的答案,若之前没有询问操作,则为 $0$。

输出格式

对每个询问操作,输出一行一个数表示答案。

样例数据

样例 1 输入

5 5
4 5 2 5 3
3 5 3
3 3 0
5 0 6
5 0 5
6 0 4

样例 1 输出

1
4
4
5
1

子任务

Idea:nzhtl1477,Solution:nzhtl1477&ccz181078,Code:nzhtl1477,Data:nzhtl1477&
FutaRimeWoawaSete

样例解释:

第一次询问中,$3$ 依次经过值为 $2,5,3$ 的变化,变为 $1,4,1$,答案为 $1$。

经过解密,第二次询问为区间 $[2,2]$,值为 $1$。

第二次询问中,$1$ 依次经过值为 $5$ 的变化,变为 $4$,答案为 $4$。

经过解密,第三次询问为区间 $[1,4]$,值为 $2$。

第三次询问中,$2$ 依次经过值为 $4,5,2,5$ 的变化,变为 $2,3,1,4$,答案为 $4$。

经过解密,第四次询问为区间 $[1,4]$,值为 $1$。

第四次询问中,$1$ 依次经过值为 $4,5,2,5$ 的变化,变为 $3,2,0,5$,答案为 $5$。

经过解密,第五次询问为区间 $[3,5]$,值为 $1$。

第五次询问中,$1$ 依次经过值为 $2,5,3$ 的变化,变为 $1,4,1$,答案为 $1$。

数据范围:

对于 $100\%$ 的数据 $1\le n,m,a_i,v \le10^5$,$1\le l,r\le n$。

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.