結果

問題 No.1741 Arrays and XOR Procedure
ユーザー 👑 Kazun
提出日時 2021-11-12 22:20:48
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 432 bytes
コンパイル時間 239 ms
コンパイル使用メモリ 81,820 KB
実行使用メモリ 98,688 KB
最終ジャッジ日時 2024-11-25 19:22:08
合計ジャッジ時間 4,122 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28 WA * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

def greedy(A):
    while len(A)>1:
        B=[]
        for i in range(len(A)-1):
            B.append(A[i]^A[i+1])
        A=B
    return A[0]

#==================================================
N=int(input())
B=list(map(int,input().split()))

Mod=998244353
Q=B[1:-1].count(-1); Q_exp=pow(2,Q,Mod)

X=0
for a in [0,1]:
    for b in [0,1]:
        if B[0] in {-1,a} and B[-1] in {-1,b} and a!=b:
            X+=Q_exp

print(X%Mod)
0