Maximum binary product of sum pairs

Maximum binary product of sum pairs

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

Time Limit: 2.0 s

Memory Limit: 512.0 MB

Description

You are given an array \(A\) of \(N\) integers. Your task is to select any two elements (they can be the same element at different positions), calculate their sum, and then calculate the product of all binary digits of this sum. Your goal is to find the maximum product value that can be obtained from any possible pair of elements.

You have to answer multiple testcases.

Input

First line takes an integer \(T\) : number of testcases
First line of each testcase takes an integer \(N\) : number of elements in the array
next line takes \(N\) integers \(A_1,A_2,A_3......A_N\)

\(1 <= T <= 10^4\)
\(2 <= N <= 2*10^5\)
\(1 <= A_i <= 10^8\)

sum of \(N\) over all testcase will not exceed \(2*10^5\)

Output

For each testcase print one integer in a new line : the maximum product value

Sample

Input Output
2
3
1 2 3
4
1 3 5 1
1
0

in testcase 1 :
you can chose first two element and obtain a sum of 3.
the binary representation of 3 is 11. so the final answer is 1*1=1

Intra LU IEEE Beginner Programming Contest

Not Attended
Status
Done
Rule
ACM/ICPC
Problem
8
Start at
2025-02-26 05:30
End at
2025-02-26 07:30
Duration
2.0 hour(s)
Host
Partic.
42