結果

問題 No.1493 隣接xor
ユーザー Alex WangAlex Wang
提出日時 2021-07-12 14:42:04
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 531 bytes
コンパイル時間 2,705 ms
コンパイル使用メモリ 150,376 KB
実行使用メモリ 12,916 KB
最終ジャッジ日時 2023-09-14 20:34:02
合計ジャッジ時間 7,173 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 169 ms
12,724 KB
testcase_04 AC 171 ms
12,784 KB
testcase_05 AC 175 ms
12,916 KB
testcase_06 AC 172 ms
12,764 KB
testcase_07 AC 173 ms
12,816 KB
testcase_08 AC 173 ms
12,816 KB
testcase_09 AC 170 ms
12,916 KB
testcase_10 AC 173 ms
12,748 KB
testcase_11 AC 175 ms
12,732 KB
testcase_12 AC 174 ms
12,828 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 AC 70 ms
8,404 KB
testcase_21 AC 83 ms
8,884 KB
testcase_22 AC 53 ms
7,240 KB
testcase_23 AC 74 ms
8,308 KB
testcase_24 AC 161 ms
12,608 KB
testcase_25 AC 52 ms
7,128 KB
testcase_26 AC 94 ms
9,260 KB
testcase_27 AC 32 ms
5,980 KB
testcase_28 AC 148 ms
11,876 KB
testcase_29 AC 94 ms
9,456 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<int, int> mp;
    mp[0] = 1;
    ll pre = 0, ans = 1;
    for(int i = 0; i < n; ++i) {
        int x; cin >> x;
        ll val = mp[pre];
        mp[pre] = ans;
        ans <<= 1;
        ans -= val;
        ans = (ans % mod + mod) % mod;
        pre ^= x;
    }
    cout << ans << '\n';
    return 0;
}
0