結果
問題 | No.1493 隣接xor |
ユーザー |
|
提出日時 | 2025-01-07 23:49:01 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 208 ms / 2,000 ms |
コード長 | 577 bytes |
コンパイル時間 | 5,862 ms |
コンパイル使用メモリ | 332,188 KB |
実行使用メモリ | 14,336 KB |
最終ジャッジ日時 | 2025-01-07 23:49:14 |
合計ジャッジ時間 | 11,439 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
ソースコード
#include <bits/stdc++.h>#include <atcoder/all>using namespace atcoder;#define rep(i, n) for (int i = 0; i < (n); ++i)using namespace std;using mint = modint1000000007;int main() {int n;cin >> n;vector<int> a(n);rep(i, n) cin >> a[i];vector<int> s(n+1);rep(i, n) s[i+1] = s[i]^a[i];s.erase(s.begin());s.pop_back();n--;mint ans = 1;map<int, mint> dp;rep(i, n) {mint tmp = ans;ans += ans-dp[s[i]];dp[s[i]] = tmp;}cout << ans.val() << '\n';return 0;}