結果
| 問題 |
No.1493 隣接xor
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-07-12 15:49:33 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 164 ms / 2,000 ms |
| コード長 | 562 bytes |
| コンパイル時間 | 1,388 ms |
| コンパイル使用メモリ | 164,456 KB |
| 実行使用メモリ | 12,928 KB |
| 最終ジャッジ日時 | 2024-07-02 03:27:59 |
| 合計ジャッジ時間 | 5,186 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 |
ソースコード
#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<int, int> mp;
ll pre = 0, ans = 1;
for(int i = 0; i < n; ++i) {
int x; cin >> x;
if(i) {
ll val = mp[pre];
mp[pre] = ans;
ans <<= 1;
ans -= val;
ans = (ans % mod + mod) % mod;
}
pre ^= x;
}
cout << ans << '\n';
return 0;
}