問題一覧 > 通常問題

No.1674 Introduction to XOR

レベル : / 実行時間制限 : 1ケース 1.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 254
作問者 : stoq / テスター : akakimidori wait_sushi
お気に入りにしたユーザー ProblemId : 6812 / 自分の提出
問題文最終更新日: 2021-08-08 16:35:43
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 313 (順位表) の他の問題:

Problem Statement

You are given a sequence $\{A_i\}$ of length $N$.

Find the minimum positive integer $X$ that satisfies the following condition. It can be shown that, under the given constraints, an $X$ satisfying the condition always exists.

  • For every $1 \leq i \leq N$, $X + A_i = X \oplus A_i$

Here, $\oplus$ denotes bitwise XOR.

Input

$N$
$A_1 \dots A_N$

  • All inputs are integers.
  • $1 \leq N \leq 100$
  • $1 \leq A_i \leq 10^{18}$

Output

Output the minimum positive integer $X$ that satisfies the condition.

Sample

Sample 1
Input
3
1 2 9
Output
4

Since $4 + 1 = 4 \oplus 1 = 5, \ 4+2 = 4 \oplus 2 = 6,\ 4+9=4 \oplus 9 = 13$, $4$ satisfies the condition.
There is no smaller $X$, so output $4$.

Sample 2
Input
5
1 3 5 7 9
Output
16

Sample 3
Input
1
576460752303423487
Output
576460752303423488

The output may not fit in a 32-bit integer.

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