Funny operations
Practice
3.8 (422 votes)
Easy
Problem
32% Success 3224 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

In this problem you will be doing some funny operations. These operations are basically a mixture of bitwise operations. You will be given a set of distinct numbers. You have to tell me the maximum value of P that can be obtained in any subset of that array. P is defined below :

    P = (XOR of all of the values in subset) OR (AND of all of the values in subset)

Here XOR , AND and OR are the bitwise operations. If multiple maximum value of P are possible then consider the subset with maximum length.

Input

First line of the input will contain T (no. of test cases). Then every test case will contain two lines. First line will have the value of N then the next line will have N space separated integers of set.

Output

For every test case, print the maximum value of P and then maximum length of the resultant subset.

Constraints

1 <= T <= 10
1 <= N <= 16
0 <= values of set <= 109

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
Tags:
OpenApprovedOpenApprovedOpenBasic ProgrammingEasyImplementationBasics of Implementation
Points:20
1 votes
Tags:
Easy
Points:30
8 votes
Tags:
MathematicsEasy-MediumMathematicsMathamatics