問題一覧 > 通常問題

No.2061 XOR Sort

レベル : / AI推定難易度 : 1425 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (解説公開後に AC するまで非表示) / 解いたユーザー数 74
作問者 : taiga0629kyopro / テスター : nok0 ygussany
お気に入りにしたユーザー ProblemId : 8340 / 自分の提出
問題文最終更新日: 2022-08-25 22:25:53
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
yukicoder contest 358 (順位表) の他の問題:

Problem Statement

You are given an integer sequence $A$ of length $N$. Perform the following operations in order to create a sequence $B$ of length $N$. ($\mathrm{XOR}$ denotes the bitwise exclusive OR.)

  • Choose one non-negative integer $X$.
  • For $i=1,2, \dots,N$, let $B_i=A_i \ \mathrm{XOR} \ X $.
  • Sort $B$ in ascending order.
  • For $i=1,2, \dots,N$, replace $B_i$ with $B_i \ \mathrm{XOR} \ X $.

How many sequences are possible as the final $B$? Find the answer modulo $998244353$. Here, two sequences $B$ and $B'$ of length $N$ are considered different if there exists an integer $i$ ($1 \le i \le N$) such that $B_i \neq B'_i$.

Input

$N$
$A_1$ $A_2$ $\dots$ $A_N$

  • $1 \le N \le 2×10^5$
  • $0 \le A_i <2^{30}$
  • All inputs are integers.
  • Output

    Print the number of sequences possible as the final $B$, modulo $998244353$.

    Sample

    Sample 1
    Input
    3
    0 0 1
    Output
    2

    The possible final sequences $B$ are the $2$ sequences $(0,0,1),(1,0,0)$.

    Sample 2
    Input
    3
    1 0 2
    Output
    4

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