Codeforces
CF Step
Youtube Linkedin Discord Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

Code: The 67th XOR Problem

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

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

    long long test = 1;
    cin >> test;
    bool submit = true;
    if (test >= 10010010)
        submit = false;
    if (test == 1)
        submit = true;

    while (test--) {
        int N;
        cin >> N;
        vector<int> A(N);
        for (auto &a : A)
            cin >> a;

        int answer = 0;
        for (int i = 0; i < N; i++)
            for (int k = i + 1; k < N; k++)
                answer = max(answer, A.at(i) ^ A.at(k));
        cout << answer << "\n";
    }
}