結果

問題 No.1493 隣接xor
ユーザー Alex WangAlex Wang
提出日時 2021-07-12 14:58:20
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 558 bytes
コンパイル時間 1,673 ms
コンパイル使用メモリ 175,396 KB
実行使用メモリ 18,840 KB
最終ジャッジ日時 2023-09-14 20:34:38
合計ジャッジ時間 5,850 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 166 ms
18,556 KB
testcase_04 AC 169 ms
18,840 KB
testcase_05 AC 170 ms
18,696 KB
testcase_06 AC 178 ms
18,656 KB
testcase_07 AC 176 ms
18,656 KB
testcase_08 AC 179 ms
18,644 KB
testcase_09 AC 173 ms
18,704 KB
testcase_10 AC 171 ms
18,680 KB
testcase_11 AC 179 ms
18,568 KB
testcase_12 AC 182 ms
18,700 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 1 ms
4,380 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 74 ms
11,180 KB
testcase_21 AC 87 ms
12,232 KB
testcase_22 AC 54 ms
9,600 KB
testcase_23 AC 76 ms
11,240 KB
testcase_24 AC 163 ms
18,096 KB
testcase_25 AC 54 ms
9,332 KB
testcase_26 AC 96 ms
12,876 KB
testcase_27 AC 33 ms
7,080 KB
testcase_28 AC 151 ms
17,052 KB
testcase_29 AC 107 ms
13,028 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define IO ios::sync_with_stdio(false);cin.tie(0)

const int mod = 1e9 + 7;


int main() {
    IO; //freopen("in.txt", "r", stdin);
    int n; cin >> n;
    map<ll, ll> mp;
    vector<ll> dp(n + 5), pre(n + 5);
    dp[0] = 1;
    mp[0] = 1;
    for(int i = 1; i <= n; ++i) {
        cin >> pre[i];
        pre[i] ^= pre[i - 1];
        dp[i] = ((dp[i - 1] + dp[i - 1] - mp[pre[i - 1]]) % mod + mod) % mod;
        mp[pre[i - 1]] = dp[i - 1];
    }
    cout << dp[n] << '\n';
    return 0;
}
0