logo AlgoBeat OnlineJudge
登录 注册

#216732. [GKS 2019 #G] The Equation

内存限制:1024 MiB 时间限制:3000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

The laws of the universe can be represented by an array of non-negative integers. The i-th of these integers is .

The universe is good if there is a non-negative integer such that the following equation is satisfied: , where xor denotes the bitwise exclusive or.

What is the largest value of for which the universe is good?

输入格式

The first line of the input gives the number of test cases, . test cases follow. Each test case begins with a line containing the two integers and , the number of integers in and the limit on the equation, respectively.

The second line contains integers, the i-th of which is , the i-th integer in the array.

输出格式

For each test case, output one line containing Case #x: y, where x is the test case number (starting from 1) and y is the largest value of k for which the universe is good, or if there is no such .

样例

样例输入 1

4
3 27
8 2 4
4 45
30 0 4 11
1 0
100
6 2
5 5 1 5 1 0

样例输出 1

Case #1: 12
Case #2: 14
Case #3: 100
Case #4: -1

数据范围与提示

In sample case #1, the array contains integers and . The largest possible value of that gives a good universe is ().

In sample case #2, the array contains integers and . The largest possible value of that gives a good universe is ().

In sample case #3, the array contains integer and . The largest possible value of that gives a good universe is ().

In sample case #4, there is no value of that gives a good universe, so the answer is .

Limits

.

.

Test set 1 (Visible)

.

, for all .

Test set 2 (Hidden)

.

, for all .