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

19245번 - XOR 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
6 초 512 MB221624226.250%

문제

Every good problemset needs a problem that can be summarized in a single doge meme. Today's problemset is no different.

Given a multiset $S$ of non-negative integers, divide it into two multisets $A$ and $B$ in a way that minimizes $|\text{xor}(A) - \text{xor}(B)|$. Here $\text{xor}(X)$ denotes the bitwise XOR of all elements of $X$.

Note that one of the multisets $A$ and $B$ can be empty, and XOR of an empty multiset is 0ドル$.

It is enough to output the minimum possible value of $|\text{xor}(A) - \text{xor}(B)|$.

입력

The first line of input contains the number of test cases $z$ (1ドル \leq z \leq 50$). The descriptions of the test cases follow, two lines per test case.

The first line of every test case contains an integer $n$ (1ドル \leq n \leq 10^5$) -- the size of the multiset.

The second line contains $n$ integers $x_i$ (0ドル \leq x_i \leq 10^{18}$) -- elements of the multiset.

출력

For each test case output one integer: the smallest possible difference of XORs.

제한

예제 입력 1

2
4
1 2 3 4
5
3 7 3 9 5

예제 출력 1

4
5

힌트

출처

Camp > Petrozavodsk Programming Camp > Winter 2018 > Day 1: Jagiellonian U Contest A번

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

출처

대학교 대회

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

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