結果

問題 No.1493 隣接xor
ユーザー 👑 NachiaNachia
提出日時 2021-12-04 13:29:58
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 771 bytes
コンパイル時間 795 ms
コンパイル使用メモリ 88,572 KB
実行使用メモリ 17,280 KB
最終ジャッジ日時 2023-09-20 23:57:58
合計ジャッジ時間 6,240 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 15 ms
4,604 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 1 ms
4,380 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
権限があれば一括ダウンロードができます

ソースコード

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