結果

問題 No.1493 隣接xor
ユーザー 👑 Nachia
提出日時 2021-12-04 13:29:58
言語 C++17(gcc12)
(gcc 12.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 771 bytes
コンパイル時間 2,840 ms
コンパイル使用メモリ 119,432 KB
最終ジャッジ日時 2025-01-26 03:32:34
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 6 WA * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <map>

using namespace std;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
#define rep(i,n) for(int i=0; i<(n); i++)


const u64 MOD = 998244353;


int main(){
    int N; cin >> N;
    vector<i64> A(N+1, 0);
    rep(i,N) cin >> A[i+1];
    rep(i,N) A[i+1] ^= A[i];
    map<i64, u64> G;
    u64 ans = 1;
    for(int i=1; i<=N-1; i++){
        i64 a = A[i];
        u64& g = G[a];
        u64 c = (ans + MOD - g) % MOD;
        g = ans;
        ans = (ans + c) % MOD;
    }
    cout << ans << endl;
    return 0;
}




struct ios_do_not_sync {
    ios_do_not_sync() {
        ios::sync_with_stdio(false);
        cin.tie(nullptr);
    }
} ios_do_not_sync_instance;

0