結果
| 問題 |
No.1741 Arrays and XOR Procedure
|
| コンテスト | |
| ユーザー |
gr1msl3y
|
| 提出日時 | 2021-11-12 23:00:43 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 116 ms / 2,000 ms |
| コード長 | 514 bytes |
| コンパイル時間 | 279 ms |
| コンパイル使用メモリ | 82,524 KB |
| 実行使用メモリ | 106,108 KB |
| 最終ジャッジ日時 | 2024-11-25 21:03:09 |
| 合計ジャッジ時間 | 5,239 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 41 |
ソースコード
N = int(input())
B = list(map(int, input().split()))
MOD = 998244353
def ord2(n):
i = 0
while not n % 2:
i += 1
n >>= 1
return i
comb = [0]*N
for i in range(1, N):
comb[i] = comb[i-1]+ord2(N-i)-ord2(i)
cta = 0
ctb = 0
v = 0
for i in range(N):
if not comb[i]:
if B[i] == -1:
cta += 1
else:
v ^= B[i]
else:
if B[i] == -1:
ctb += 1
if v == cta == 0:
print(0)
else:
print(pow(2, ctb+max(0, cta-1), MOD))
gr1msl3y