結果

問題 No.1456 Range Xor
ユーザー ninoinuininoinui
提出日時 2021-12-29 10:11:04
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 3,510 bytes
コンパイル時間 2,377 ms
コンパイル使用メモリ 203,484 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-03 15:15:49
合計ジャッジ時間 4,225 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,820 KB
testcase_01 AC 2 ms
6,816 KB
testcase_02 AC 2 ms
6,816 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 4 ms
6,816 KB
testcase_12 AC 3 ms
6,820 KB
testcase_13 AC 6 ms
6,816 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 7 ms
6,816 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 4 ms
6,816 KB
testcase_25 AC 5 ms
6,820 KB
testcase_26 AC 8 ms
6,820 KB
testcase_27 WA -
testcase_28 AC 5 ms
6,820 KB
testcase_29 AC 13 ms
6,820 KB
testcase_30 WA -
testcase_31 AC 5 ms
6,820 KB
testcase_32 AC 4 ms
6,816 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 AC 12 ms
6,820 KB
testcase_38 AC 3 ms
6,820 KB
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 2 ms
6,816 KB
testcase_42 AC 3 ms
6,816 KB
testcase_43 AC 2 ms
6,820 KB
testcase_44 AC 2 ms
6,816 KB
testcase_45 AC 2 ms
6,820 KB
testcase_46 AC 2 ms
6,816 KB
testcase_47 AC 2 ms
6,816 KB
testcase_48 AC 2 ms
6,820 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#ifndef _DEBUG
#define _DEBUG
#include __FILE__

int main() {
    long N, K;
    cin >> N >> K;
    vector<long> A(N);
    for (auto&& a : A) cin >> a;

    for (long l = 0, r = 0, sum = 0; r < N; r++) {
        sum ^= A.at(r);
        if (sum == K) return cout << "Yes" << '\n', 0;
        while (l + 1 <= r && (sum ^ A.at(l)) >= K) sum ^= A.at(l), l++;
        if (sum == K) return cout << "Yes" << '\n', 0;
    }
    cout << "No" << '\n';
}

#else
// #undef _DEBUG
#include <bits/stdc++.h>
using namespace std;

template <typename T, typename T2>
bool cmin(T& a, const T2& b) {
    return a > b ? a = b, true : false;
}

template <typename T, typename T2>
bool cmax(T& a, const T2& b) {
    return a < b ? a = b, true : false;
}

__attribute__((constructor)) void ios_setup() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
}

template <typename T>
ostream& operator<<(ostream& os, const vector<T>& vec);

template <typename T>
ostream& operator<<(ostream& os, const vector<vector<T> >& vec);

template <typename T>
ostream& operator<<(ostream& os, const vector<vector<vector<T> > >& vec);

template <typename T, typename U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
    return os << "(" << p.first << ", " << p.second << ")";
}

template <typename A, typename B, typename C>
ostream& operator<<(ostream& os, const tuple<A, B, C>& t) {
    const auto& [a, b, c] = t;
    return os << "(" << a << ", " << b << ", " << c << ")";
}

template <typename A, typename B, typename C, typename D>
ostream& operator<<(ostream& os, const tuple<A, B, C, D>& t) {
    const auto& [a, b, c, d] = t;
    return os << "(" << a << ", " << b << ", " << c << ", " << d << ")";
}

template <typename T>
ostream& operator<<(ostream& os, priority_queue<T> pq) {
    os << "{";
    while (!pq.empty()) os << pq.top() << (pq.size() > 1 ? " " : ""), pq.pop();
    return os << "}";
}

#define FOREACH(it, a) for (auto it = (a).begin(); it != (a).end(); it++)

template <typename T>
ostream& operator<<(ostream& os, const set<T>& se) {
    os << "{";
    FOREACH (it, se) { os << (it == se.begin() ? "" : " ") << *it; }
    return os << "}";
}

template <typename T>
ostream& operator<<(ostream& os, const multiset<T>& ms) {
    os << "{";
    FOREACH (it, ms) { os << (it == ms.begin() ? "" : " ") << *it; }
    return os << "}";
}

template <typename T, typename U>
ostream& operator<<(ostream& os, const map<T, U>& ma) {
    os << "{";
    FOREACH (it, ma) { os << (it == ma.begin() ? "" : " ") << *it; }
    return os << "}";
}

template <typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    os << "{";
    FOREACH (it, vec) { os << (it == vec.begin() ? "" : " ") << *it; }
    return os << "}";
}

template <typename T>
ostream& operator<<(ostream& os, const vector<vector<T> >& vec) {
    os << "{\n";
    FOREACH (it, vec) { os << (it == vec.begin() ? " " : "\n ") << *it; }
    return os << "\n}";
}

template <typename T>
ostream& operator<<(ostream& os, const vector<vector<vector<T> > >& vec) {
    os << "{\n";
    FOREACH (it, vec) {
        os << (it == vec.begin() ? "" : "\n") << "(" << it - vec.begin() << ") " << *it;
    }
    return os << "\n}";
}

void dump() {}
template <typename Head, typename... Tail>
void dump(const Head& head, const Tail&... tail) {
    cout << head << (sizeof...(tail) ? ", " : "\n"), dump(tail...);
}

#ifdef _DEBUG
#define DUMP(...) cout << "[" << (#__VA_ARGS__) << "] ", dump(__VA_ARGS__)
#else
#define DUMP(...) (void)0
#endif

#endif
0