시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
2 초 | 512 MB | 1 | 1 | 1 | 100.000% |
bobo has a sequence $a_1, a_2, \dots, a_n$. He would like to choose $k$ consecutive elements and maximize the value $S$ that is defined as their maximum plus their bitwise or.
For all $1 \leq k \leq n$, find the maximal value bobo can achieve.
The first line contains an integer $n$ ($1 \leq n \leq 10^5$).
The second line contains $n$ integers $a_1, a_2, \dots, a_n$ ($0 \leq a_i < 2^{16}$).
$n$ integers, where the $i$-th integer is maximal $S$ for $k=i$.
3 1 0 2
4 4 5