24 hour archive: Problem
3128  AND of Two 3128  AND of Two 3128  AND of Two
Statistics  Sub: 194  AC: 45  AC%: 23,20  Score: 2,67 
Created by  José Carlos González Fernández 
Added by  jcfernandez (20150225) 
Limits 
Total Time: 2000 MS
Memory: 62 MB  Output: 64 MB  Size:
14 KB

Enabled languages  
Available in 
Description
Nolberto learnt bitwiseoperation recently. He got very fascinated about bitwiseoperation for its wonderful uses. But his girlfriend is not sure of that he has enough skills to solve bitwiseoperation problem. So, she decides to test his skills by giving a problem.
She gave N nonnegative integers A1, A2,...AN, and asks him to find the pair of integers such that AND operation on that pair of integers is maximum.
AND is a bitwise operation which is corresponding to & in C++ and Java.
She gave N nonnegative integers A1, A2,...AN, and asks him to find the pair of integers such that AND operation on that pair of integers is maximum.
AND is a bitwise operation which is corresponding to & in C++ and Java.
Nolberto learnt bitwiseoperation recently. He got very fascinated about bitwiseoperation for its wonderful uses. But his girlfriend is not sure of that he has enough skills to solve bitwiseoperation problem. So, she decides to test his skills by giving a problem.
She gave N nonnegative integers A1, A2,...AN, and asks him to find the pair of integers such that AND operation on that pair of integers is maximum.
AND is a bitwise operation which is corresponding to & in C++ and Java.
She gave N nonnegative integers A1, A2,...AN, and asks him to find the pair of integers such that AND operation on that pair of integers is maximum.
AND is a bitwise operation which is corresponding to & in C++ and Java.
Nolberto learnt bitwiseoperation recently. He got very fascinated about bitwiseoperation for its wonderful uses. But his girlfriend is not sure of that he has enough skills to solve bitwiseoperation problem. So, she decides to test his skills by giving a problem.
She gave N nonnegative integers A1, A2,...AN, and asks him to find the pair of integers such that AND operation on that pair of integers is maximum.
AND is a bitwise operation which is corresponding to & in C++ and Java.
She gave N nonnegative integers A1, A2,...AN, and asks him to find the pair of integers such that AND operation on that pair of integers is maximum.
AND is a bitwise operation which is corresponding to & in C++ and Java.
Input specification
The first line of the input contains an integer 1 <= T <= 100 denoting the number of test cases.
The description of T test cases follows: The first line of the input contains a single integer 2 <= N <= 10^5. The ith line in the next N lines contains the 0<=Ai<=10^3.
The description of T test cases follows: The first line of the input contains a single integer 2 <= N <= 10^5. The ith line in the next N lines contains the 0<=Ai<=10^3.
The first line of the input contains an integer 1 <= T <= 100 denoting the number of test cases.
The description of T test cases follows: The first line of the input contains a single integer 2 <= N <= 10^5. The ith line in the next N lines contains the 0<=Ai<=10^3.
The description of T test cases follows: The first line of the input contains a single integer 2 <= N <= 10^5. The ith line in the next N lines contains the 0<=Ai<=10^3.
The first line of the input contains an integer 1 <= T <= 100 denoting the number of test cases.
The description of T test cases follows: The first line of the input contains a single integer 2 <= N <= 10^5. The ith line in the next N lines contains the 0<=Ai<=10^3.
The description of T test cases follows: The first line of the input contains a single integer 2 <= N <= 10^5. The ith line in the next N lines contains the 0<=Ai<=10^3.
Output specification
Print a single integer which is the largest value of Ax AND Ay where 1 <= x < y <= N.
Print a single integer which is the largest value of Ax AND Ay where 1 <= x < y <= N.
The first line of the input contains an integer 1 <= T <= 100 denoting the number of test cases.
The description of T test cases follows: The first line of the input contains a single integer 2 <= N <= 10^5. The ith line in the next N lines contains the 0<=Ai<=10^3.
The description of T test cases follows: The first line of the input contains a single integer 2 <= N <= 10^5. The ith line in the next N lines contains the 0<=Ai<=10^3.
Sample input
1
4
2
4
8
10
Sample output
8
Hint(s)
http://coj.uci.cu/24h/
http://coj.uci.cu/24h/
http://coj.uci.cu/24h/