QOJ.ac

QOJ

시간 제한: 1 s 메모리 제한: 512 MB 총점: 100

#18761. 数列とクエリ 3

통계

入力

1 行目には数列の長さ $N$ $(1 \le N \le 100{,}000)$ が与えられる。

2 行目には $A_1, A_2, \ldots, A_N$ $(1 \le A_i \le 10^9)$ が与えられる。

3 行目にはクエリの個数 $M$ $(1 \le M \le 100{,}000)$ が与えられる。

続く $M$ 行のそれぞれには $a, b, c$ が与えられる。値 $a, b, c$ は次のようにクエリを構成するのに使われる:

  • $i = a \oplus \text{last\_ans}$
  • $j = b \oplus \text{last\_ans}$
  • $k = c \oplus \text{last\_ans}$

ここで $\text{last\_ans}$ は直前のクエリの答えであり、初期値は $0$ である。XOR の結果は $1 \le i \le j \le n$ かつ $1 \le k \le 10^9$ を満たす。

出力

各クエリに対して答えを 1 行ずつ出力せよ。

入出力例

入力例 1

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

出力例 1

2
0
3

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.