結果
| 問題 |
No.1493 隣接xor
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-04-30 21:39:20 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 431 bytes |
| コンパイル時間 | 718 ms |
| コンパイル使用メモリ | 77,916 KB |
| 実行使用メモリ | 14,592 KB |
| 最終ジャッジ日時 | 2024-07-19 00:53:44 |
| 合計ジャッジ時間 | 5,248 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 WA * 2 |
コンパイルメッセージ
main.cpp:9:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
9 | main()
| ^~~~
ソースコード
#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;
mp[now]=0;
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;
}