結果

問題 No.1456 Range Xor
ユーザー a
提出日時 2023-07-28 06:44:39
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 138 ms / 2,000 ms
コード長 495 bytes
コンパイル時間 1,685 ms
コンパイル使用メモリ 176,336 KB
実行使用メモリ 13,056 KB
最終ジャッジ日時 2024-10-05 15:52:39
合計ジャッジ時間 6,949 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 46
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main() {
    int N, K;
    cin >> N >> K;
    vector<int> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }
    map<int, int> mp;
    mp[0]++;
    bool ok = false;
    int x = 0;
    for (int i = 0; i < N; i++) {
        x ^= A[i];
        if (mp[x ^ K] > 0) {
            ok = true;
        }
        mp[x]++;
    }
    if (ok) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}
0