No.130 XOR Minimax
タグ : / 解いたユーザー数 189
作問者 :
sugim48
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もしくは右上の雲マークをクリックしてアカウントを作成してください。