問題一覧 > 通常問題

No.2895 Zero XOR Subset

レベル : / AI推定難易度 : 1450 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / スペシャルジャッジ問題 (複数の解が存在する可能性があります)
タグ : (AC するまで非表示) / 解いたユーザー数 81
作問者 : 蜜蜂 / テスター : Mitarushi
お気に入りにしたユーザー ProblemId : 11388 / 自分の提出
問題文最終更新日: 2024-09-19 21:52:13
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 447 オムニバス (順位表) の他の問題:

Problem Statement

You are given a sequence of non-negative integers $A = \left( A_1, A_2, \cdots, A_N \right)$ of length $N$.

Determine whether there exists a sequence $B$ satisfying the following conditions, and if one exists, show one example. Here, let $M$ be the length of $B$.

  • $1 \leq B_i \leq N$
  • $B_i \neq B_j$ whenever $1 \leq i < j \leq M$
  • $A_{B_1} \oplus A_{B_2} \oplus \cdots \oplus A_{B_M} = 0$, where for non-negative integers $x,y$, $x \oplus y$ denotes the bitwise XOR of $x$ and $y$.

Input

$N$
$A_1\ \ A_2\ \ \cdots A_N$

  • $1 \leq N \leq 2 \times 10^5$
  • $0 \leq A_i < 2^{60}$
  • All inputs are integers.

Output

If no sequence $B$ satisfying the conditions exists, print -1 followed by a newline.
Otherwise, output in the following format.

$M$
$B_1\ \ B_2\ \ \cdots B_M$
If there are multiple valid outputs, print any $1$ of them.

Sample

Sample 1
Input
4
2 0 2 4
Output
2
1 3

This output is valid because $A_{B_1} \oplus A_{B_2} = A_1 \oplus A_3 = 2 \oplus 2 = 0$.
The following output would also be accepted, among others.

1
2

Sample 2
Input
3
2024 20 24
Output
-1

No sequence $B$ satisfying the conditions exists.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。