atcoder#ARC100C. [ARC100E] Or Plus Max
[ARC100E] Or Plus Max
Score : points
Problem Statement
There is an integer sequence of length : . (Note that the sequence is -indexed.)
For every integer satisfying , solve the following problem:
- Let and be integers. Find the maximum value of where and . Here, denotes the bitwise OR.
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print lines. In the -th line, print the answer of the problem above for .
2
1 2 3 1
3
4
5
For , the only possible pair of and is , so the answer is .
For , the possible pairs of and are . When , . This is the maximum value, so the answer is .
For , the possible pairs of and are . When , . This is the maximum value, so the answer is .
3
10 71 84 33 6 47 23 25
81
94
155
155
155
155
155
4
75 26 45 72 81 47 97 97 2 2 25 82 84 17 56 32
101
120
147
156
156
178
194
194
194
194
194
194
194
194
194