結果
問題 | No.1456 Range Xor |
ユーザー |
|
提出日時 | 2023-05-04 15:57:13 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 36 ms / 2,000 ms |
コード長 | 556 bytes |
コンパイル時間 | 2,107 ms |
コンパイル使用メモリ | 199,840 KB |
最終ジャッジ日時 | 2025-02-12 16:53:33 |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 46 |
ソースコード
#include <bits/stdc++.h>using namespace std;using ll = long long;int main() {ios::sync_with_stdio(false); cin.tie(nullptr);int n, k;cin >> n >> k;vector<int> a(n);for (int i = 0; i < n; ++i) {cin >> a[i];}vector<int> s(n + 1);unordered_set<int> st;st.insert(0);for (int i = 0; i < n; ++i) {s[i + 1] = s[i] ^ a[i];if (st.count(s[i + 1] ^ k)) {cout << "Yes\n";return 0;}st.insert(s[i + 1]);}cout << "No\n";return 0;}