問題一覧 > 通常問題

No.130 XOR Minimax

レベル : / AI推定難易度 : 1300 / 実行時間制限 : 1ケース 5.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 189
作問者 : sugim48
お気に入りにしたユーザー ProblemId : 282 / 自分の提出
問題文最終更新日: 2026-06-26 20:12:51
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 77 (順位表) の他の問題:

Problem Statement

You are given a sequence of non-negative integers $a_1\ ,\ a_2\ ,\ \ldots\ ,\ a_N$.
You want to choose a suitable non-negative integer $x$ so as to minimize the maximum value of $a_1\oplus x\ ,\ a_2\oplus x\ ,\ \ldots\ ,\ a_N\oplus x$.
Here, $\oplus$ denotes bitwise XOR.
Find the minimized maximum value.

Input

$N$
$a_1$ $a_2$ $\ldots$ $a_N$

The first line contains the number of terms of the sequence, $N(1\leq N\leq10^5)$.
The second line contains the sequence $a_i(0\leq a_i\leq10^9)$, separated by spaces.

Output

Output the minimized maximum value.
Print a newline at the end.

Sample

Sample 1
Input
1
1
Output
0

If we choose $x=1$, then $a_1\oplus x=1\oplus1=0$.

Sample 2
Input
2
2 3
Output
1

For example, if we choose $x=2$, then $a_1\oplus x=2\oplus2=0\ ,\ a_2\oplus x=3\oplus2=1$, and the maximum value is $1$.

Sample 3
Input
3
0 4 0
Output
4

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