All Submissions


Two integers x and y form a lucky pair, if the result of their bitwise AND equals zero

You are given an array of integers
Your task is to find for every array element ,whether it forms a lucky pair with some other array element

Input
First line has number of test cases T<=5
The first line of each test case has an integer n (1<=n<=10^6) - the number of elements in the given array.
The second line contains n space-separated integers a1,a2..an (1<=ai<=10^6) — the elements of the given array.
The numbers in the array can coincide.

Output
For each test case,Print n space seperated integers in a line.
If a[i] forms a lucky pair with any other element of the given array , then ans[i] should be equal to 1.
Otherwise ans[i] is 0.

Sample Input:
2
5
3 6 2 9 10
10
1 3 5 500 6 9 3 8 9 75


Sample Output:
0 1 1 1 0
1 1 1 1 1 1 1 1 1 0


Setter: Jayant Mukherji

Languages: Brain,C,C++,Java,C#,JavaScript,Pascal,Perl,PHP,Python,Ruby,Text

Time Limit: 6 Second(s)
Score: 100 Point(s)
Input File Limit: 50000 Bytes

Submit

Login to post clarification.

No Clarifications.

Contest

Mode Judge

Passive

Online

Overall Rankings

RankNameScore
1xyz0
2Ams0
3TIP0
4team420
5xyzz0
6asdasdasd0
7abcd0
8khankhan0
9Gabriel0
10gigel0