QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 500 MB Total points: 100

#7469. 竞赛实验班

统计

题目描述

有一个长度为 $n$ 的数组 $A$。下标从 $1$ 开始标号。有 $m$ 个操作需要处理,操作有如下四种:

  1. 在数组 $A$ 的末尾添加一个数 $x$。
  2. 输出 $\sum_{i=l}^{r}A_i$。
  3. 将数组 $A$ 中的每个数 $A_i$ 都改为 $A_i\oplus x$。($\oplus$ 表示异或操作)。
  4. 将数组 $A$ 从小到大排序。

输入格式

第一行一个数 $n$ 表示 $A$ 的初始大小。

接下来一行 $n$ 个非负整数 $A_i$,表示 $A$ 的中的每个元素。

接下来一行一个数 表示询问的数量。

接下来 $m$ 行,每行表示一个操作:

  • 1 x: 表示第一种操作,在末尾插入数 $x$。
  • 2 l r:表示第二种操作,询问 $\sum_{i=l}^{r}A_i$。保证有 $1\le l\le r\le n'$,其中 $n'$ 为操作时刻序列的长度。
  • 3 x:表示第三种操作,给每个数 $\oplus$ 上 $x$。
  • 4:表示第四种操作,将数组 $A$ 排序。

输出格式

对于每个第二种操作,输出答案。

样例数据

样例 1 输入

5
5 2 6 2 0
5
2 1 5
1 2
3 7
2 2 6
4

样例 1 输出

15
23

提示

Idea:WJMZBMR,Solution:WJMZBMR,Code:WJMZBMR,Data:WJMZBMR

$1\le n,\,m\le 10^5, 0\le x,A_i\le 10^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.