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

30697번 - Present 서브태스크다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 1024 MB33201762.963%

문제

Catherine received an array of integers as a gift for March 8. Eventually she grew bored with it, and she started calculated various useless characteristics for it. She succeeded to do it for each one she came up with. But when she came up with another one --- xor of all pairwise sums of elements in the array, she realized that she couldn't compute it for a very large array, thus she asked for your help. Can you do it? Formally, you need to compute

$$\begin{align*} (a_1 + a_2) \oplus (a_1 + a_3) \oplus \ldots \oplus (a_1 + a_n) \oplus \\ \oplus (a_2 + a_3) \oplus \ldots \oplus (a_2 + a_n) \oplus \\ \ldots \\ \oplus (a_{n-1} + a_n) \\ \end{align*}$$

입력

The first line contains a single integer $n$ (2ドル \leq n \leq 400,000円$) --- the number of integers in the array.

The second line contains integers $a_1, a_2, \ldots, a_n$ (1ドル \leq a_i \leq 10^7$).

출력

Print a single integer --- xor of all pairwise sums of integers in the given array.

제한

서브태스크

번호배점제한
134

$n \le 1000$

237

1ドル \le a_i \le 100$

329

예제 입력 1

2
1 2

예제 출력 1

3

예제 입력 2

3
1 2 3

예제 출력 2

2

노트

In the first sample case there is only one sum 1ドル + 2 = 3$.

In the second sample case there are three sums: 1ドル + 2 = 3,ドル 1ドル + 3 = 4,ドル 2ドル + 3 = 5$. In binary they are represented as 011ドル_2 \oplus 100_2 \oplus 101_2 = 010_2,ドル thus the answer is 2.

$\oplus$ is the bitwise xor operation. To define $x \oplus y,ドル consider binary representations of integers $x$ and $y$. We put the $i$-th bit of the result to be 1 when exactly one of the $i$-th bits of $x$ and $y$ is 1. Otherwise, the $i$-th bit of the result is put to be 0. For example, 0101ドル_2 ,円 \oplus ,円 0011_2 = 0110_2$.

출처

Olympiad > Moscow Open Olympiad in Informatics > Moscow Open Olympiad in Informatics 2019-20 > Day 2 Salt Lake City번

채점 및 기타 정보

  • 예제는 채점하지 않는다.
  • 이 문제의 채점 우선 순위는 2이다.
(追記) (追記ここまで)

출처

대학교 대회

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

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