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

31604번 - XOR Operations 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 1024 MB95393540.698%

문제

You are given $n$ integers $a_1, a_2, \dots , a_n$. You have a sequence of $n$ integers $B = (b_1, b_2, \dots , b_n)$ which initially are all zeroes.

In one operation, you choose two different indices $i$ and $j,ドル then simultaneously

  • replace $b_i$ with $b_i \oplus a_i \oplus a_j,ドル and
  • replace $b_j$ with $b_j \oplus a_i \oplus a_j$.

Note that $\oplus$ represents the bitwise XOR operation, which returns an integer whose binary representation has a 1ドル$ in each bit position for which the corresponding bits of either but not both operands are 1ドル$. For example, 3ドル \oplus 10 = 9$ because $(0011)_2 \oplus (1010)_2 = (1001)_2$.

You want to compute the number of different possible sequences $B$ you can obtain after performing zero or more operations. Since this number might be huge, calculate this number modulo 998ドル,円 244,円 353$.

Two sequences of length $n$ are considered different if and only if there exists an index $i$ (1ドル ≤ i ≤ n$) such that the $i$-th element of one sequence differs from the $i$-th element of the other sequence.

입력

The first line of input contains one integer $n$ (2ドル ≤ n ≤ 200,円 000$). The second line contains $n$ integers $a_1, a_2, \dots , a_n$ (0ドル ≤ a_i < 2^{30}$ for all $i$).

출력

Output an integer representing the number of different possible sequences $B$ you can obtain after performing zero or more operations modulo 998ドル,円 244,円 353$.

제한

예제 입력 1

3
1 2 1

예제 출력 1

4

Starting from $B = (0, 0, 0),ドル we can obtain the following two sequences $B$:

  • Perform the operation with $i = 1$ and $j = 2$. We will have $B = (3, 3, 0)$.
  • After that, perform the operation with $i = 2$ and $j = 3$. We will have $B = (3, 0, 3)$.

Starting from $B = (0, 0, 0),ドル we can also obtain the following sequence $B$:

  • Perform the operation with $i = 2$ and $j = 3$. We will have $B = (0, 3, 3)$.

It can be shown that $(0, 0, 0),ドル $(3, 3, 0),ドル $(3, 0, 3),ドル and $(0, 3, 3)$ are the only possible sequences $B$ you can obtain. Therefore, the answer is 4ドル$.

예제 입력 2

4
852415 852415 852415 852415

예제 출력 2

1

힌트

출처

ICPC > Regionals > Asia Pacific > Asia Pacific Championship > The 2024 ICPC Asia Pacific Championship L번

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

출처

대학교 대회

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

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