QOJ.ac

QOJ

Límite de tiempo: 1 s Límite de memoria: 512 MB Puntuación total: 100

#17364. XOR and Afterimage

Estadísticas

Given a sequence $a$ of $n$ non-negative integers, perform $q$ operations, where each operation is one of the following three types:

  • 1: Simultaneously update $a_i \leftarrow a_i \oplus a_{i+1}$ for all $i \in [1, n)$.
  • 2: Simultaneously update $a_i \leftarrow a_i \oplus a_{i-1}$ for all $i \in (1, n]$.
  • 3 l r: Calculate $\bigoplus_{i=l}^r a_i$.

Input

The first line contains two positive integers $n$ and $q$.

The second line contains $n$ non-negative integers, representing the sequence $a$.

The next $q$ lines each contain one or three positive integers, representing an operation.

Output

For each operation of type 3, output one number per line representing the answer.

Examples

Input 1

5 5
1 4 5 2 6
1
3 2 4
2
3 2 4
3 1 1

Output 1

2
1
5

Input 2

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

Output 2

8
11
6

Constraints

For all test cases, it is guaranteed that:

  • $1 \le n \le 3 \times 10^5$
  • $1 \le q \le 3 \times 10^5$
  • $0 \le a_i < 2^{30}$

This problem uses bundled testing. The special properties of each subtask are as follows:

Subtask $n, q \le$ Special Property Score
$1$ $5000$ None $8$
$2$ $3 \times 10^5$ A $18$
$3$ $3 \times 10^5$ B $22$
$4$ $5 \times 10^4$ None $24$
$5$ $3 \times 10^5$ None $28$

Special Property A: No operation 2.

Special Property B: The number of type 3 operations does not exceed one.

Discussions

About Discussions

The discussion section is only for posting: 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.
  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.