No.2061 XOR Sort
タグ : / 解いたユーザー数 74
作問者 :
taiga0629kyopro
/ テスター :
nok0
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$
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もしくは右上の雲マークをクリックしてアカウントを作成してください。