Yes XOR No
Submissions: 870   Accuracy:

20.07%

  Difficulty: Medium   Marks: 4

You are given two arrays A and B,each of size 'N' .Lets say X= all the Count of different pairs of Ai and Bj, such that (Ai xor Bj) is present in any of the Two arrays.
Now, If X is even , Print "Yes" else Print "No".
Note: Use fast I/O as there is very large Testcase file.

Input:
First Line contains an integer 'T'-  which denotes the number of test cases.
Each line of the testcase contains, an integer -'N', and then N space separed Non negative Integers.

Output:
For each Test case, Print Yes or no.

Constraints:
1<=T<=400
500<=N<=800
10^6<=Ai, Bi <=10^12

Example:
Input:

1
3
1 5 7
2 4 8
Output:
Yes
Explanation:
xor(1,2)=3
xor(1,4)=5 Present
xor(1,8)=9
xor(5,2)=7 Present
xor(5,4)=1 Present
xor(5,8)=13
xor(7,2)=5 Present
xor(7,4)=3
xor(7,8)=15
Out of all these xors, 5,7,1,5 are present...so X=4 which is even....Hence Output: Yes

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Abhinav Jain(iamabjain)
Author: iamabjain


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.

to report an issue on this page.