Contest Duration: - (local time) (180 minutes)

Submission #18186529

Source Code Expand

Copy
```#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
#include<complex>
#include<cassert>
using namespace std;
#include<atcoder/all>
using namespace atcoder;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MAX = 4000001;
const long double eps = 1E-14;

ll max(ll a, ll b) {
if (a > b) { return a; }
return b;
}

ll min(ll a, ll b) {
if (a > b) { return b; }
return a;
}

ll gcd(ll a, ll b) {
if (b == 0) { return a; }
if (a < b) { return gcd(b, a); }
return gcd(b, a % b);
}

ll lcm(ll a, ll b) {
return a / gcd(a, b) * b;
}

struct edge {
ll ind;
ll fr;
ll to;
ll d;
};

using mint = modint1000000007;

typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;

typedef vector<mint> vmint;
typedef vector<vector<mint>> vvmint;
typedef vector<vector<vector<mint>>> vvvmint;
/////////////////////////////////////

int main() {
ll N, K;
cin >> N >> K;
vll a(N + 1);
repn(i, N)cin >> a[i];
ll t = 0;
repn(i, N)t += a[i];

ll S = 1;
while (S <= t) { S *= 2; }

vll c(S);
repn(i, N)c[a[i]]++;

vmint dp(S, 0);
dp[0] = 1;

rep(i, S) {
if (c[i] == 0) { continue; }

mint p = (mint(2)).pow(c[i] - 1);

vmint ndp(S + 1, 0);
rep(j, S) {
ndp[j] = (dp[j] + dp[j ^ i]) * p;
}

swap(dp, ndp);
}

cout << dp[K].val() << endl;
}
```

Submission Info

Submission Time 2020-11-17 17:21:58+0900 F - Limited Xor Subset dokin C++ (GCC 9.2.1) 500 1643 Byte AC 151 ms 6052 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 500 / 500
Status
 AC × 3
 AC × 33
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All sample_01.txt, sample_02.txt, sample_03.txt, subtask_1_1.txt, subtask_1_10.txt, subtask_1_11.txt, subtask_1_12.txt, subtask_1_13.txt, subtask_1_14.txt, subtask_1_15.txt, subtask_1_16.txt, subtask_1_17.txt, subtask_1_18.txt, subtask_1_19.txt, subtask_1_2.txt, subtask_1_20.txt, subtask_1_21.txt, subtask_1_22.txt, subtask_1_23.txt, subtask_1_24.txt, subtask_1_25.txt, subtask_1_26.txt, subtask_1_27.txt, subtask_1_28.txt, subtask_1_29.txt, subtask_1_3.txt, subtask_1_30.txt, subtask_1_4.txt, subtask_1_5.txt, subtask_1_6.txt, subtask_1_7.txt, subtask_1_8.txt, subtask_1_9.txt
Case Name Status Exec Time Memory
sample_01.txt AC 6 ms 3532 KB
sample_02.txt AC 2 ms 3588 KB
sample_03.txt AC 2 ms 3540 KB
subtask_1_1.txt AC 18 ms 5172 KB
subtask_1_10.txt AC 19 ms 5232 KB
subtask_1_11.txt AC 18 ms 5204 KB
subtask_1_12.txt AC 14 ms 5352 KB
subtask_1_13.txt AC 15 ms 5180 KB
subtask_1_14.txt AC 20 ms 5408 KB
subtask_1_15.txt AC 13 ms 5332 KB
subtask_1_16.txt AC 13 ms 5336 KB
subtask_1_17.txt AC 10 ms 5412 KB
subtask_1_18.txt AC 21 ms 5704 KB
subtask_1_19.txt AC 12 ms 5584 KB
subtask_1_2.txt AC 14 ms 5408 KB
subtask_1_20.txt AC 151 ms 5316 KB
subtask_1_21.txt AC 150 ms 5324 KB
subtask_1_22.txt AC 3 ms 3684 KB
subtask_1_23.txt AC 2 ms 3660 KB
subtask_1_24.txt AC 5 ms 5280 KB
subtask_1_25.txt AC 25 ms 6052 KB
subtask_1_26.txt AC 7 ms 5340 KB
subtask_1_27.txt AC 7 ms 5316 KB
subtask_1_28.txt AC 7 ms 5404 KB
subtask_1_29.txt AC 6 ms 5312 KB
subtask_1_3.txt AC 18 ms 5244 KB
subtask_1_30.txt AC 6 ms 5228 KB
subtask_1_4.txt AC 15 ms 5248 KB
subtask_1_5.txt AC 15 ms 5232 KB
subtask_1_6.txt AC 20 ms 5544 KB
subtask_1_7.txt AC 16 ms 5232 KB
subtask_1_8.txt AC 45 ms 5312 KB
subtask_1_9.txt AC 90 ms 5352 KB