結果

問題 No.1741 Arrays and XOR Procedure
ユーザー ytft
提出日時 2021-12-27 18:37:32
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 593 bytes
コンパイル時間 1,286 ms
コンパイル使用メモリ 166,288 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-01 05:07:11
合計ジャッジ時間 3,594 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 38 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main(){
    int N,mod=998244353,count=0,temp,ans=mod/2+1,flg=1,B,cur=0;
    cin>>N;
    for(int i=0;i<N;++i){
        cin>>B;
        if(B==-1){
            ans=(ans<<1)%mod;
            flg&=count;
        }else if(!count){
        	cur^=B;
        }
        temp=max(1,N-i-1);
        while(temp%2==0){
            temp>>=1;
            ++count;
        }
        temp=i+1;
        while(temp%2==0){
            temp>>=1;
            --count;
        }
    }
    if(flg){
        ans=(ans<<1)%mod;
    }
    cout<<(flg&&!cur?0:ans)<<endl;
}
0