Fu_L's Library

This documentation is automatically generated by online-judge-tools/verification-helper

View the Project on GitHub Fu-L/cp-library

:heavy_check_mark: verify/yukicoder/184.test.cpp

Depends on

Code

#define PROBLEM "https://yukicoder.me/problems/481"
#include "../../src/template/template.hpp"
#include "../../src/math/xor_base.hpp"
int main(void) {
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i, 0, n) cin >> a[i];
    vector<ll> base = xor_base(a);
    ll ans = 1;
    rep(i, 0, (int)base.size()) ans *= 2;
    cout << ans << '\n';
}
#line 1 "verify/yukicoder/184.test.cpp"
#define PROBLEM "https://yukicoder.me/problems/481"
#line 2 "src/template/template.hpp"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<long long, long long>;
#define rep(i, a, b) for(long long i = (a); i < (b); ++i)
#define rrep(i, a, b) for(long long i = (a); i >= (b); --i)
constexpr long long inf = 4e18;
struct SetupIO {
    SetupIO() {
        ios::sync_with_stdio(0);
        cin.tie(0);
        cout << fixed << setprecision(30);
    }
} setup_io;
#line 3 "src/math/xor_base.hpp"
template <typename T>
vector<T> xor_base(const vector<T>& a) {
    vector<T> base;
    for(T v : a) {
        for(const T& e : base) {
            if((v xor e) < v) v ^= e;
        }
        for(T& e : base) {
            if((v xor e) < e) e ^= v;
        }
        if(v) base.emplace_back(v);
    }
    return base;
}
#line 4 "verify/yukicoder/184.test.cpp"
int main(void) {
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i, 0, n) cin >> a[i];
    vector<ll> base = xor_base(a);
    ll ans = 1;
    rep(i, 0, (int)base.size()) ans *= 2;
    cout << ans << '\n';
}
Back to top page