| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 2 초 | 1024 MB | 137 | 101 | 49 | 84.483% |
You are given an integer array $A$ of length $N,ドル consisting of 0ドル$'s and 1ドル$'s. Let $a$ be initially the array $A$. You are going to perform the following operation $N-1$ times.
There are 2ドル^{N-1} \times (N-1)!$ ways to perform the operations. Count the number of ways that result in a single value of 1ドル,ドル modulo 998244353ドル$.
The first line contains an integer $N$ (1ドル \leq N \leq 10^6$).
The second line contains integers $A_1,A_2,\ldots,A_N$ (0ドル \leq A_i \leq 1$).
Print the answer.
3 0 1 0
2
5 1 1 1 1 1
384
7 0 1 1 0 1 0 1
25515