結果

問題 No.1493 隣接xor
ユーザー kotatsugamekotatsugame
提出日時 2021-04-30 21:44:30
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 255 ms / 2,000 ms
コード長 419 bytes
コンパイル時間 706 ms
コンパイル使用メモリ 77,908 KB
実行使用メモリ 14,808 KB
最終ジャッジ日時 2023-09-26 05:38:59
合計ジャッジ時間 6,073 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,380 KB
testcase_01 AC 2 ms
4,428 KB
testcase_02 AC 3 ms
4,492 KB
testcase_03 AC 247 ms
14,528 KB
testcase_04 AC 245 ms
14,808 KB
testcase_05 AC 243 ms
14,652 KB
testcase_06 AC 250 ms
14,652 KB
testcase_07 AC 243 ms
14,808 KB
testcase_08 AC 241 ms
14,576 KB
testcase_09 AC 249 ms
14,808 KB
testcase_10 AC 253 ms
14,536 KB
testcase_11 AC 255 ms
14,592 KB
testcase_12 AC 255 ms
14,536 KB
testcase_13 AC 85 ms
5,436 KB
testcase_14 AC 32 ms
5,212 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 2 ms
4,384 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 3 ms
4,376 KB
testcase_19 AC 2 ms
4,540 KB
testcase_20 AC 108 ms
9,616 KB
testcase_21 AC 127 ms
10,388 KB
testcase_22 AC 81 ms
8,668 KB
testcase_23 AC 107 ms
9,704 KB
testcase_24 AC 229 ms
14,116 KB
testcase_25 AC 76 ms
8,416 KB
testcase_26 AC 126 ms
10,712 KB
testcase_27 AC 46 ms
7,076 KB
testcase_28 AC 209 ms
13,556 KB
testcase_29 AC 132 ms
10,964 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:9:1: 警告: ISO C++ では型の無い ‘main’ の宣言を禁止しています [-Wreturn-type]
    9 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
#include<map>
#include<atcoder/modint>
using namespace std;
using mint=atcoder::modint1000000007;
int N;
int A[2<<17];
mint dp[2<<17];
main()
{
	cin>>N;
	int now=0;
	dp[0]=1;
	mint sum=1;
	map<int,int>mp;
	for(int i=0;i<N;i++)
	{
		cin>>A[i];
		now^=A[i];
		int id=-1;
		if(mp.find(now)!=mp.end())id=mp[now];
		mp[now]=i+1;
		sum+=dp[i+1]=sum;
		if(id!=-1)sum-=dp[id];
	}
	cout<<dp[N].val()<<endl;
}
0