結果
問題 |
No.1493 隣接xor
|
ユーザー |
|
提出日時 | 2021-07-12 14:42:04 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 531 bytes |
コンパイル時間 | 1,925 ms |
コンパイル使用メモリ | 164,576 KB |
実行使用メモリ | 12,800 KB |
最終ジャッジ日時 | 2024-07-02 03:26:24 |
合計ジャッジ時間 | 5,736 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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<int, int> mp; mp[0] = 1; ll pre = 0, ans = 1; for(int i = 0; i < n; ++i) { int x; cin >> x; ll val = mp[pre]; mp[pre] = ans; ans <<= 1; ans -= val; ans = (ans % mod + mod) % mod; pre ^= x; } cout << ans << '\n'; return 0; }