QOJ.ac

QOJ

Time Limit: 1.5 s Memory Limit: 31.25 MB Total points: 100

#7483. Ynoi

统计

题目描述

维护一个由n个非负整数构成的序列 $a_1,a_2,a_3,\ldots,a_n$,支持三种操作:

  1. 给定区间 $[l,r]$,将对应区间内的数异或上 $x$。
  2. 给定区间 $[l,r]$,将对应区间内的数从小到大排序。
  3. 给定区间 $[l,r]$,求区间内的数的异或和。

输入格式

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

第二行 $n$ 个整数 $a_i$,表示原序列。

接下来 $m$ 行,每行三个整数 $opt,l,r$($opt\in\{2,3\}$)或四个整数 $opt,l,r,x$($opt=1$)表示对应的操作。

输出格式

对每个操作 $3$,输出一行,表示对应的答案。

样例 #1

样例输入 #1

5 3
1 4 2 8 3
2 1 3
1 2 4 5
3 1 2

样例输出 #1

6

提示

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

样例解释

原序列为 $1\ 4\ 2\ 8\ 3$。

将区间 $[1,3]$ 排序,得到 $[1\ 2\ 4]\ 8\ 3$。

将区间 $[2,4]$ 与 $5$ 按位取异或,$2\ \mathrm{xor}\ 5 = 7$,$4\ \mathrm{xor}\ 5 = 1$,$8\ \mathrm{xor}\ 5 = 13$,得到 $1\ [7\ 1\ 13]\ 3$。

查询区间 $[1,2]$ 的异或和,$[1\ 7]\ 1\ 13\ 3$,$1\ \mathrm{xor}\ 7 = 6$。

数据范围

$1 \le n,m \le 10^5$,$0 \le a_i,x<10^8$。

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.