XOR sum
Time Limit: 2000/1000 MS (Java/others) memory limit: 132768/132768 K (Java/Others)
Total submission (s): 0 accepted submission (s): 0
Problem description
Zeus and Prometheus are playing a game. Prometheus gives Zeus a set that contains n positive integers. Then Prometheus initiates M inquiries to Zeus, and each query contains a positive integer S, then Zeus needs to find a positive integer k in the set, so that K and s have the greatest difference or result. Prometheus allows Zeus to seek help from humans in order to make Zeus see the greatness of mankind. Can you prove human wisdom?
Input
The input includes several groups of trial data, each of which contains several rows. The first line of the input is an integer T (t <10), indicating that T groups of data are jointly owned. The first row of each group of data enters two positive integers n, m (<1 = n, m <= 100000), and the next row contains n positive integers, representing the set obtained by Zeus, in the next m row, each row has a positive integer (s), representing the positive integer queried by Prometheus. All positive integers cannot exceed 2 ^ 32.
Output
For each group of data, you must first output a separate line "case #? : ", Where the question mark should be filled with the current number of data groups. The number of groups starts from 1. For each query, a positive integer k is output to make K and s exclusive or maximum.
Sample Input
23 23 4 5154 14 6 5 63
Sample output
Case #1:43Case #2:4
Statistic | submit | clarifications | back
Dictionary tree