2014 question 3 of Baidu star

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.