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$。

Discussions

About Discussions

The discussion section is only for posting: Editorials, General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues. Submitting multiple issues may cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.