結果
問題 | No.1741 Arrays and XOR Procedure |
ユーザー | rlangevin |
提出日時 | 2023-07-06 12:27:30 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 96 ms / 2,000 ms |
コード長 | 431 bytes |
コンパイル時間 | 175 ms |
コンパイル使用メモリ | 81,912 KB |
実行使用メモリ | 100,096 KB |
最終ジャッジ日時 | 2024-07-20 07:43:28 |
合計ジャッジ時間 | 5,147 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 41 |
ソースコード
N = int(input()) B = list(map(int, input().split())) mod = 998244353 odd, even, zero_or_one = 0, 0, 0 for i in range(N): if (N - 1) & i == i: if B[i] == -1: odd += 1 elif B[i] == 1: zero_or_one ^= 1 else: if B[i] == -1: even += 1 if odd: print(pow(2, even + odd - 1, mod)) else: if zero_or_one: print(pow(2, even, mod)) else: print(0)