Page Contents
Chef Is Just Throwing Random Words SOLUTION
Chef once had a deep epiphany and ended up saying: Given a sequence of positive integers a1,a2,…,aN, if you take each of its 2N subsequences and write down the sum of elements of this subsequence, what will the bitwise OR of the written integers be?
Yes, you read it right, but can you solve it?
Input
The first line of the input contains a single integer T denoting the number of test cases. The description of T test cases follows.
The first line of each test case contains a single integer N.
The second line contains N space-separated integers a1,a2,…,aN.
Output
For each test case, print a single line containing one integer ― the bitwise OR of sums of all subsequences.
Constraints
1≤T≤5
1≤N≤105
1≤ai<230 for each valid i
Subtasks
Subtask #1 (100 points): original constraints
Example Input
2
2
1 1
3
1 9 8
Example Output
3
27
SOLUTION AFTER CONTEST
ESET FREE LINCENSE KEYS UPDATED 2020 : https://www.cybergeeksquad.co/2020/11/eset-free-lincense-keys-updated-2020.html
Chegg FREE Premium Accounts:
Udemy Leak Courses:
November Challenge 2020 SOLUTION CodeChef
- Selecting Edges SOLUTION SELEDGE
- Panic! at the Disco SOLUTION PANIC
- Restore Sequence SOLUTION RESTORE
October Lunchtime 2020 CodeChef SOLUTIONS
RELATED :