結果

問題 No.1493 隣接xor
ユーザー uzzyuzzy
提出日時 2021-05-01 00:11:58
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 210 ms / 2,000 ms
コード長 981 bytes
コンパイル時間 2,815 ms
コンパイル使用メモリ 190,240 KB
実行使用メモリ 16,692 KB
最終ジャッジ日時 2023-09-26 09:18:25
合計ジャッジ時間 7,813 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 203 ms
16,640 KB
testcase_04 AC 199 ms
16,588 KB
testcase_05 AC 206 ms
16,640 KB
testcase_06 AC 210 ms
16,648 KB
testcase_07 AC 203 ms
16,592 KB
testcase_08 AC 202 ms
16,564 KB
testcase_09 AC 203 ms
16,648 KB
testcase_10 AC 204 ms
16,592 KB
testcase_11 AC 206 ms
16,652 KB
testcase_12 AC 203 ms
16,692 KB
testcase_13 AC 27 ms
4,384 KB
testcase_14 AC 14 ms
4,380 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 86 ms
10,216 KB
testcase_21 AC 98 ms
11,168 KB
testcase_22 AC 67 ms
8,776 KB
testcase_23 AC 90 ms
10,392 KB
testcase_24 AC 191 ms
16,052 KB
testcase_25 AC 62 ms
8,672 KB
testcase_26 AC 110 ms
11,732 KB
testcase_27 AC 37 ms
6,784 KB
testcase_28 AC 189 ms
15,264 KB
testcase_29 AC 114 ms
11,984 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize ("O2")
#pragma GCC target ("avx")
#include<bits/stdc++.h>
//#include<atcoder/all>
//using namespace atcoder;

using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);


	int N;
	cin >> N;
	int A[200000];
	rep(i, N) cin >> A[i];

	const int mod = 1e9 + 7;
	map<int, ll> MP;

	if (N == 1) {
		co(1);
		return 0;
	}

	ll kotae = 2;
	MP[0] = 1;
	int x = 0;
	rep1(i, N - 2) {
		x ^= A[i];
		ll tmp = kotae - MP[x];
		kotae = (kotae + tmp) % mod;
		MP[x] = (MP[x] + tmp) % mod;
	}
	co((kotae + mod) % mod);

	Would you please return 0;
}
0