結果

問題 No.1456 Range Xor
ユーザー MisterMister
提出日時 2021-03-31 21:01:19
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 60 ms / 2,000 ms
コード長 475 bytes
コンパイル時間 739 ms
コンパイル使用メモリ 76,532 KB
最終ジャッジ日時 2025-01-20 02:18:42
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 46
権限があれば一括ダウンロードができます

ソースコード

diff #

#line 1 "main.cpp"
#include <iostream>
#include <set>

using namespace std;

void solve() {
    int n, k;
    cin >> n >> k;

    set<int> s{0};
    int sum = 0;
    while (n--) {
        int x;
        cin >> x;
        sum ^= x;

        if (s.count(sum ^ k)) {
            cout << "Yes\n";
            return;
        }
        s.insert(sum);
    }

    cout << "No\n";
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    solve();

    return 0;
}
0