問題一覧 > 通常問題

No.1876 Xor of Sum

レベル : / AI推定難易度 : 1500 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 47
作問者 : ytqm3
お気に入りにしたユーザー ProblemId : 7861 / 自分の提出
問題文最終更新日: 2022-11-01 10:56:19
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original

Problem Statement

You are given a positive integer $N$ and a sequence $A$ of $N$ positive integers.

Consider the sum of each non-empty (not necessarily contiguous) subsequence of $A$, and find the $\mathrm{xor}$ of all those sums.

Constraints

  • All input values are integers.
  • $1 \le N \le 2000$
  • $1 \le A_i \le 2000$

Input

$\large N$
$\large A_1$ $\large A_2$ $\large \ldots$ $\large A_N$

Output

Output the answer.

Sample

Sample 1
Input
3
1 2 3
Output
4

We have $1 \oplus 2 \oplus 3 \oplus 3 \oplus 4 \oplus 5 \oplus 6 = 4$.

Sample 2
Input
1
1
Output
1

Sample 3
Input
10
3 1 4 1 5 9 2 6 5 3
Output
32

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。