Set Selection
Practice
1.7 (7 votes)
Algorithms
Approved
Medium
Open
Two dimensional
Problem
69% Success 844 Attempts 30 Points 1s Time Limit 256MB Memory 1024 KB Max Code

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

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:30
1 votes
Tags:
Dynamic Programming2D dynamic programmingAlgorithms
Points:30
11 votes
Tags:
Dynamic Programming2D dynamic programmingAlgorithms
Points:30
4 votes
Tags:
Dynamic Programming2D dynamic programmingAlgorithms