結果
| 問題 |
No.1493 隣接xor
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-07-12 14:58:20 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 558 bytes |
| コンパイル時間 | 2,258 ms |
| コンパイル使用メモリ | 176,948 KB |
| 実行使用メモリ | 18,944 KB |
| 最終ジャッジ日時 | 2024-07-02 03:26:56 |
| 合計ジャッジ時間 | 5,592 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 WA * 2 |
ソースコード
#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;
vector<ll> dp(n + 5), pre(n + 5);
dp[0] = 1;
mp[0] = 1;
for(int i = 1; i <= n; ++i) {
cin >> pre[i];
pre[i] ^= pre[i - 1];
dp[i] = ((dp[i - 1] + dp[i - 1] - mp[pre[i - 1]]) % mod + mod) % mod;
mp[pre[i - 1]] = dp[i - 1];
}
cout << dp[n] << '\n';
return 0;
}