提出 #70095634


ソースコード 拡げる

#include <bits/stdc++.h>
#ifdef LOCAL
#include <debug.hpp>
#else
#define debug(...) void(0)
#endif

template <class T, class U = T> bool chmin(T& x, U&& y) { return y < x and (x = std::forward<U>(y), true); }

template <class T, class U = T> bool chmax(T& x, U&& y) { return x < y and (x = std::forward<U>(y), true); }

template <class T> void mkuni(std::vector<T>& v) {
    std::ranges::sort(v);
    auto result = std::ranges::unique(v);
    v.erase(result.begin(), result.end());
}

template <class T> int lwb(const std::vector<T>& v, const T& x) {
    return std::distance(v.begin(), std::ranges::lower_bound(v, x));
}

using namespace std;

using ll = long long;

void solve() {
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }

    int OR = 0, XOR = 0;
    for (int i = 0; i < N; i++) {
        OR |= A[i];
        XOR ^= A[i];
    }
    XOR ^= OR;

    cout << (XOR ? "Alice" : "Bob") << "\n";
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);

    int t;
    cin >> t;
    for (; t--;) {
        solve();
    }
    return 0;
}

提出情報

提出日時
問題 A - Bitwise OR Game
ユーザ rniya
言語 C++ 23 (gcc 12.2)
得点 500
コード長 1208 Byte
結果 AC
実行時間 18 ms
メモリ 3856 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 500 / 500
結果
AC × 1
AC × 23
セット名 テストケース
Sample 00_sample_00.txt
All 00_sample_00.txt, 01_handmade_00.txt, 01_handmade_01.txt, 01_handmade_02.txt, 01_handmade_03.txt, 01_handmade_04.txt, 01_handmade_05.txt, 01_handmade_06.txt, 01_handmade_07.txt, 01_handmade_08.txt, 01_handmade_09.txt, 02_Bob_00.txt, 02_Bob_01.txt, 02_Bob_02.txt, 02_Bob_03.txt, 02_Bob_04.txt, 02_Bob_05.txt, 02_Bob_06.txt, 02_Bob_07.txt, 02_Bob_08.txt, 03_Alice_00.txt, 03_Alice_01.txt, 03_Alice_02.txt
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 1 ms 3520 KiB
01_handmade_00.txt AC 15 ms 3528 KiB
01_handmade_01.txt AC 18 ms 3476 KiB
01_handmade_02.txt AC 11 ms 3468 KiB
01_handmade_03.txt AC 15 ms 3424 KiB
01_handmade_04.txt AC 18 ms 3324 KiB
01_handmade_05.txt AC 16 ms 3440 KiB
01_handmade_06.txt AC 15 ms 3392 KiB
01_handmade_07.txt AC 11 ms 3480 KiB
01_handmade_08.txt AC 12 ms 3816 KiB
01_handmade_09.txt AC 12 ms 3796 KiB
02_Bob_00.txt AC 12 ms 3476 KiB
02_Bob_01.txt AC 12 ms 3480 KiB
02_Bob_02.txt AC 13 ms 3488 KiB
02_Bob_03.txt AC 12 ms 3420 KiB
02_Bob_04.txt AC 11 ms 3856 KiB
02_Bob_05.txt AC 12 ms 3840 KiB
02_Bob_06.txt AC 11 ms 3828 KiB
02_Bob_07.txt AC 11 ms 3764 KiB
02_Bob_08.txt AC 17 ms 3516 KiB
03_Alice_00.txt AC 13 ms 3520 KiB
03_Alice_01.txt AC 11 ms 3448 KiB
03_Alice_02.txt AC 11 ms 3416 KiB