QOJ.ac

QOJ

Limite de temps : 1 s Limite de mémoire : 256 MB Points totaux : 100

#974. 四個 XOR

Statistiques

給定一個包含 $n$ 個相異整數的數列 $A_{1 \dots n}$,你需要回答是否存在四個索引 $x, y, z, w$ 滿足 $1 \le x < y < z < w \le n$ 且 $A_x \oplus A_y \oplus A_z \oplus A_w = 0$。

回想一下,$x \oplus y$ 代表 $x$ 與 $y$ 之間的位元互斥或(bitwise exclusive-or),有時也表示為 $x \text{ xor } y$。

輸入格式

第一行包含一個整數 $n$ ($4 \le n \le 10^5$)。

第二行包含 $n$ 個整數 $A_{1 \dots n}$ ($0 \le A_i \le 10^5$)。保證所有 $A_i$ 皆相異。

輸出格式

若存在四個索引滿足上述條件,輸出「Yes」,否則輸出「No」。

範例

範例輸入 1

5
1 2 3 4 5

範例輸出 1

Yes

範例輸入 2

5
1 2 4 8 16

範例輸出 2

No

範例輸入 3

5
1 3 4 8 9

範例輸出 3

No

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.