#abc281f. F - Xor Minimization
F - Xor Minimization
Score : points
问题描述
给定一个非负整数序列 。
现在,对序列 执行以下操作仅一次:
- 选择一个非负整数 。然后,对于所有 ,将 的值替换为 和 的按位异或结果。
令 表示操作后 中的最大值。找出 可能达到的最小值。
什么是按位异或?非负整数 和 的按位异或(bitwise XOR)运算记作 ,定义如下:
- 当 以二进制表示时,第 低位()是 ,当且仅当 和 的第 低位中恰好有一个是 ,否则该位为 。
例如: (以二进制表示:)。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
You are given a sequence of non-negative integers .
Let us perform the following operation on just once.
- Choose a non-negative integer . Then, for every , replace the value of with the bitwise XOR of and .
Let be the maximum value in after the operation. Find the minimum possible value of .
What is bitwise XOR? The bitwise XOR of non-negative integers and , , is defined as follows.
- When is written in binary, the -th lowest bit () is if exactly one of the -th lowest bits of and is , and otherwise.
For instance, (in binary: ).
Constraints
- All values in the input are integers.
Input
The input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
3
12 18 11
Sample Output 1
16
If we do the operation with , the sequence becomes , where the maximum value is .
We cannot make smaller than , so this value is the answer.
Sample Input 2
10
0 0 0 0 0 0 0 0 0 0
Sample Output 2
0
Sample Input 3
5
324097321 555675086 304655177 991244276 9980291
Sample Output 3
805306368
update @ 2024/3/10 11:48:48