結果

問題 No.1493 隣接xor
ユーザー 👑 NachiaNachia
提出日時 2021-12-04 13:30:16
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 154 ms / 2,000 ms
コード長 772 bytes
コンパイル時間 825 ms
コンパイル使用メモリ 88,840 KB
実行使用メモリ 17,104 KB
最終ジャッジ日時 2023-09-20 23:58:21
合計ジャッジ時間 4,851 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 150 ms
17,092 KB
testcase_04 AC 154 ms
16,976 KB
testcase_05 AC 151 ms
17,052 KB
testcase_06 AC 151 ms
17,100 KB
testcase_07 AC 145 ms
17,036 KB
testcase_08 AC 147 ms
17,020 KB
testcase_09 AC 154 ms
16,972 KB
testcase_10 AC 154 ms
17,104 KB
testcase_11 AC 152 ms
16,956 KB
testcase_12 AC 153 ms
17,020 KB
testcase_13 AC 27 ms
4,560 KB
testcase_14 AC 15 ms
4,628 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 2 ms
4,384 KB
testcase_20 AC 65 ms
10,104 KB
testcase_21 AC 74 ms
11,216 KB
testcase_22 AC 45 ms
8,856 KB
testcase_23 AC 62 ms
10,440 KB
testcase_24 AC 149 ms
16,568 KB
testcase_25 AC 44 ms
8,648 KB
testcase_26 AC 82 ms
11,756 KB
testcase_27 AC 26 ms
6,740 KB
testcase_28 AC 129 ms
15,648 KB
testcase_29 AC 84 ms
12,440 KB
権限があれば一括ダウンロードができます

ソースコード

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 = 1000000007;


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