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

32086번 - Deck-Building Game 다국어

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

문제

You are playing a deck-building game with your friend. There are $N$ cards, numbered from 1ドル$ to $N$. Card $i$ has the value of $A_i$.

You want to build two decks; one for you and one for your friend. A card cannot be inside both decks, and it is allowed to not use all $N$ cards. It is also allowed for a deck to be empty, i.e. does not contain any cards.

The power of a deck is represented as the bitwise XOR of the value of the cards in the deck. The power of an empty deck is 0ドル$.

The game is balanced if both decks have the same power.

Determine the number of ways to build two decks such that the game is balanced. Two ways are considered different if one of the decks contains at least one different card. Since the answer can be very large, calculate the answer modulo 998ドル,円 244,円 353$.

입력

The first line consists of an integer $N$ (2ドル ≤ N ≤ 100,円 000$).

The following line consists of $N$ integers $A_i$ (1ドル ≤ A_i ≤ 100,円 000$).

출력

Output an integer representing the number of ways to build two decks such that the game is balanced. Output the answer modulo 998ドル,円 244,円 353$.

제한

예제 입력 1

4
16 12 4 8

예제 출력 1

9

Denote $S$ and $T$ as the set of cards in your deck and your friend’s deck, respectively. There are 9ドル$ ways to build the decks such that the game is balanced.

  • $S = \{\}$ and $T = \{\}$. Both decks have the power of 0ドル$.
  • $S = \{2, 3, 4\}$ and $T = \{\}$. Both decks have the power of 0ドル$.
  • $S = \{\}$ and $T = \{2, 3, 4\}$. Both decks have the power of 0ドル$.
  • $S = \{2, 4\}$ and $T = \{3\}$. Both decks have the power of 4ドル$.
  • $S = \{3\}$ and $T = \{2, 4\}$. Both decks have the power of 4ドル$.
  • $S = \{2, 3\}$ and $T = \{4\}$. Both decks have the power of 8ドル$.
  • $S = \{4\}$ and $T = \{2, 3\}$. Both decks have the power of 8ドル$.
  • $S = \{3, 4\}$ and $T = \{2\}$. Both decks have the power of 12ドル$.
  • $S = \{2\}$ and $T = \{3, 4\}$. Both decks have the power of 12ドル$.

예제 입력 2

4
1 2 4 8

예제 출력 2

1

The only way to make the game balanced is to have both decks empty.

예제 입력 3

2
1 1

예제 출력 3

5

There are 5ドル$ ways to build the decks such that the game is balanced.

  • $S = \{\}$ and $T = \{\}$. Both decks have the power of 0ドル$.
  • $S = \{1, 2\}$ and $T = \{\}$. Both decks have the power of 0ドル$.
  • $S = \{\}$ and $T = \{1, 2\}$. Both decks have the power of 0ドル$.
  • $S = \{1\}$ and $T = \{2\}$. Both decks have the power of 1ドル$.
  • $S = \{2\}$ and $T = \{1\}$. Both decks have the power of 1ドル$.

예제 입력 4

6
1 1 1 2 2 2

예제 출력 4

169

힌트

출처

ICPC > Regionals > Asia Pacific > Indonesia > Jakarta > The 2023 ICPC Asia Jakarta Regional Contest K번

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

출처

대학교 대회

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

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