Logo
(追記) (追記ここまで)

19078번 - New Divide 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB28201872.000%

문제

Consider an array of $k$ integers $b_1, b_2, \ldots, b_k$. Let $x \oplus y$ be the bitwise exclusive OR of $x$ and $y$. We shall say the linear power of the array $b$ is $$\mathit{LP} (b) = \max\limits_{i = 0, 1, \ldots, k} (b_1 \oplus \ldots \oplus b_i) + (b_{i + 1} \oplus \ldots \oplus b_k)\text{.}$$

You are given an array $a$ of $n$ integers. Find the linear power of all its prefixes.

입력

The first line contains a positive integer $n$ (1ドル \le n \le 10^6$), the length of the array.

The second line contains $n$ integers $a_i$ (0ドル \le a_i \le 10^6$).

출력

Output a single line containing $n$ space-separated integers: $\mathit{LP} (a_1),ドル $\mathit{LP} (a_1, a_2),ドル $\ldots,ドル $\mathit{LP} (a_1, a_2, \ldots, a_n)$.

제한

예제 입력 1

5
1 2 3 4 5

예제 출력 1

1 3 6 10 9

예제 입력 2

10
11 13 14 14 9 8 0 10 10 7

예제 출력 2

11 24 20 24 15 23 23 17 23 30

힌트

출처

Camp > Petrozavodsk Programming Camp > Summer 2017 > Day 5: Moscow IPT Contest B번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /