結果

問題 No.1493 隣接xor
ユーザー 沙耶花沙耶花
提出日時 2021-04-30 21:55:18
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 803 bytes
コンパイル時間 4,529 ms
コンパイル使用メモリ 268,588 KB
実行使用メモリ 28,948 KB
最終ジャッジ日時 2023-09-26 05:58:23
合計ジャッジ時間 13,937 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 530 ms
28,424 KB
testcase_04 AC 516 ms
28,784 KB
testcase_05 AC 533 ms
28,948 KB
testcase_06 AC 531 ms
28,356 KB
testcase_07 AC 522 ms
28,736 KB
testcase_08 AC 528 ms
28,804 KB
testcase_09 AC 523 ms
28,704 KB
testcase_10 AC 505 ms
28,400 KB
testcase_11 AC 508 ms
28,924 KB
testcase_12 AC 510 ms
28,352 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 2 ms
4,384 KB
testcase_20 AC 231 ms
16,228 KB
testcase_21 AC 271 ms
17,992 KB
testcase_22 AC 173 ms
13,708 KB
testcase_23 AC 237 ms
16,556 KB
testcase_24 AC 498 ms
27,764 KB
testcase_25 AC 162 ms
13,364 KB
testcase_26 AC 281 ms
18,632 KB
testcase_27 AC 97 ms
9,916 KB
testcase_28 AC 443 ms
26,244 KB
testcase_29 AC 295 ms
19,112 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
using mint = modint1000000007;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf 1000000000

mint op(mint a,mint b){
	return a+b;
}

mint e(){
	return 0;
}

int main(){
	
	int N;
	cin>>N;
	
	vector<int> A(N);
	rep(i,N){
		cin>>A[i];
	}
	
	rep(i,N-1){
		A[i+1] ^= A[i];
	}
	
	map<int,vector<int>> mp;
	
	rep(i,N){
		if(mp[A[i]].size()==0){
			mp[A[i]].push_back(0);
		}
		mp[A[i]].push_back(i+1);
	}
	
	segtree<mint,op,e> seg(N+1);
	seg.set(0,1);
	
	rep(i,N){
		int d = distance(mp[A[i]].begin(),lower_bound(mp[A[i]].begin(),mp[A[i]].end(),i+1));
		int ind = mp[A[i]][d-1];
		seg.set(i+1,seg.prod(ind,i+1));
	}
	
	mint ans = seg.get(N);
	
	cout<<ans.val()<<endl;
	
	
    return 0;
}
0