結果
| 問題 | No.1741 Arrays and XOR Procedure |
| コンテスト | |
| ユーザー |
gr1msl3y
|
| 提出日時 | 2021-11-12 23:00:43 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 86 ms / 2,000 ms |
| コード長 | 514 bytes |
| 記録 | |
| コンパイル時間 | 190 ms |
| コンパイル使用メモリ | 85,248 KB |
| 実行使用メモリ | 110,464 KB |
| 最終ジャッジ日時 | 2026-05-20 10:48:34 |
| 合計ジャッジ時間 | 4,555 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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