Set Selection

1.7

7 votes
Problem

Maggu is the most brilliant student in his class .He has given some maths assignment by his maths teacher. But, today he has to go to Lissa's Birthday party. Therefore, he can't get enough time to complete his assignment. So, Can you provide him a helping hand. He asked you because you are second most intelligent student from the same class.

Assignment problem:
Given a set of integers containing n elements (A[i] where 1<=i<=n) and thereafter T question each containing single integer Z . you need to tell whether it is possible to take any subset from the original set such that sum of the elements in it when XOR'd with Z results in zero.

INPUT:
first line of the input contains a single integer n denoting the number of elements in the set. Next line of input contains n space separated integers denoting elements of set. Next line of input contains a single integer T denoting the number of question.Next T lines contains T integers Z describing each question.(one per line)

OUTPUT:
output consists of T lines each containing either "Yes" or "No" (quotes for clarity) depending upon existence of such subset.

1<=n<=100
1<=A[i]<=1000
1<=T<=1000000
1<=z<=1000000

Sample Input
3
1 2 3 
5
1 
2
3
4
7
Sample Output
Yes
Yes
Yes
Yes
No
Time Limit: 1
Memory Limit: 256
Source Limit:
Editor Image

?