Submission #1822090


Source Code Expand

Copy
#include <cmath>
#include <cstdio>
#include <numeric>
#include <vector>
#define repeat(i, n) for (int i = 0; (i) < int(n); ++(i))
#define whole(x) begin(x), end(x)
using namespace std;

constexpr int mod = 1e9+7;
int main() {
    // input
    int n, k; scanf("%d%d", &n, &k);
    vector<int> a(n); repeat (i, n) scanf("%d", &a[i]);
    // solve
    int limit = accumulate(whole(a), 0, bit_or<int>());
    limit = pow(2, ceil(log2(limit + 1)));
    vector<int> cur(limit);
    cur[0] = 1;
    for (int a_i : a) {
        vector<int> prv = cur;
        repeat (j, limit) {
            cur[j] += prv[j ^ a_i];
            if (cur[j] > mod) cur[j] -= mod;
        }
    }
    // output
    printf("%d\n", cur[k]);
    return 0;
}

Submission Info

Submission Time
Task F - Limited Xor Subset
User kimiyuki
Language C++14 (Clang 3.8.0)
Score 0
Code Size 755 Byte
Status CE

Compile Error

./Main.cpp:15:41: error: use of undeclared identifier 'bit_or'
    int limit = accumulate(whole(a), 0, bit_or<int>());
                                        ^
./Main.cpp:15:51: error: expected '(' for function-style cast or type construction
    int limit = accumulate(whole(a), 0, bit_or<int>());
                                               ~~~^
./Main.cpp:15:53: error: expected expression
    int limit = accumulate(whole(a), 0, bit_or<int>());
                                                    ^
3 errors generated.