結果

問題 No.1493 隣接xor
ユーザー Alex WangAlex Wang
提出日時 2021-07-12 14:42:36
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 528 bytes
コンパイル時間 1,376 ms
コンパイル使用メモリ 152,884 KB
実行使用メモリ 16,012 KB
最終ジャッジ日時 2023-09-14 20:34:17
合計ジャッジ時間 6,092 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 175 ms
15,932 KB
testcase_04 AC 173 ms
15,880 KB
testcase_05 AC 178 ms
15,920 KB
testcase_06 AC 177 ms
15,932 KB
testcase_07 AC 180 ms
16,012 KB
testcase_08 AC 182 ms
15,876 KB
testcase_09 AC 179 ms
15,892 KB
testcase_10 AC 179 ms
15,880 KB
testcase_11 AC 173 ms
15,992 KB
testcase_12 AC 175 ms
15,880 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 1 ms
4,380 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 AC 74 ms
10,024 KB
testcase_21 AC 90 ms
10,760 KB
testcase_22 AC 57 ms
8,560 KB
testcase_23 AC 79 ms
10,040 KB
testcase_24 AC 172 ms
15,360 KB
testcase_25 AC 60 ms
8,472 KB
testcase_26 AC 101 ms
11,168 KB
testcase_27 AC 33 ms
6,724 KB
testcase_28 AC 157 ms
14,624 KB
testcase_29 AC 102 ms
11,480 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;
    mp[0] = 1;
    ll pre = 0, ans = 1;
    for(int i = 0; i < n; ++i) {
        ll 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