Submission #19534140


Source Code Expand

Copy
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<algorithm>
#include<cassert>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include<list>
#include <cstring>
#include <functional>
//#include<unordered_map>
//#include<unordered_set>
#include<bitset>
using namespace std;
#define MOD 1000000007
#define MOD2 998244353
#define INF ((1<<30)-1)
#define LINF ((Int)1<<60)
#define EPS (1e-10)
#define REP(i,n) for(int i=0; i<(int)(n); ++i)
#define RREP(i,n) for(int i=1; i<=(int)(n); ++i)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);++i)
typedef long long Int;
typedef pair<Int, Int> PI;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<double> vec;
typedef vector<vec> mat;
const int N = 100005;
//////////////////////////////

class BIT {
	const int n;
	vector<Int> bit;
public:
	BIT(int _n = 0) : n(_n), bit(n + 1, 0) {}
	void add(int i, const Int x = 1) { for (i++; i <= n; i += i&-i) bit[i] += x; }
	Int sum(int i) { Int x = 0; for (i++; i; i -= i & -i) x += bit[i]; return x; }
	Int sum(int i, int j) { return sum(j) - sum(i - 1); }
};

int n, k;
int a[N];
Int dp[2][N];

void solve()
{
	cin >> n >> k;
	REP(i, n) cin >> a[i];
	sort(a, a + n);

	int limit = 0;
	dp[0][0] = 1;

	REP(i, n) {
		int cur = (i + 1) % 2;
		int prev = 1 - cur;
		memset(dp[cur], 0, sizeof(Int) * limit);
		REP(j, limit + 1) {
			dp[cur][j] += dp[prev][j];
			dp[cur][j] %= MOD;
			dp[cur][j ^ a[i]] += dp[prev][j];
			dp[cur][j ^ a[i]] %= MOD;
		}
		limit |= a[i];
	}
	cout << dp[n % 2][k] << endl;
}

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(13);
	solve();
	return 0;
}

Submission Info

Submission Time
Task F - Limited Xor Subset
User chuka231
Language C++ (GCC 9.2.1)
Score 0
Code Size 1773 Byte
Status WA
Exec Time 16 ms
Memory 4660 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 500
Status
WA × 3
AC × 15
WA × 18
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 WA 7 ms 3540 KB
sample_02.txt WA 3 ms 3612 KB
sample_03.txt WA 3 ms 3484 KB
subtask_1_1.txt AC 5 ms 4332 KB
subtask_1_10.txt WA 5 ms 3864 KB
subtask_1_11.txt AC 4 ms 3684 KB
subtask_1_12.txt WA 4 ms 3884 KB
subtask_1_13.txt WA 3 ms 3648 KB
subtask_1_14.txt WA 4 ms 4224 KB
subtask_1_15.txt WA 4 ms 4196 KB
subtask_1_16.txt AC 2 ms 3696 KB
subtask_1_17.txt AC 2 ms 3620 KB
subtask_1_18.txt WA 16 ms 3908 KB
subtask_1_19.txt WA 8 ms 3684 KB
subtask_1_2.txt AC 7 ms 4308 KB
subtask_1_20.txt WA 4 ms 3684 KB
subtask_1_21.txt WA 4 ms 3616 KB
subtask_1_22.txt AC 2 ms 3540 KB
subtask_1_23.txt AC 5 ms 3548 KB
subtask_1_24.txt AC 2 ms 3564 KB
subtask_1_25.txt WA 15 ms 3988 KB
subtask_1_26.txt AC 4 ms 3552 KB
subtask_1_27.txt AC 2 ms 3668 KB
subtask_1_28.txt AC 5 ms 4660 KB
subtask_1_29.txt AC 3 ms 3668 KB
subtask_1_3.txt WA 3 ms 4356 KB
subtask_1_30.txt AC 4 ms 4056 KB
subtask_1_4.txt AC 4 ms 4252 KB
subtask_1_5.txt AC 2 ms 4192 KB
subtask_1_6.txt WA 12 ms 3700 KB
subtask_1_7.txt WA 11 ms 3616 KB
subtask_1_8.txt WA 5 ms 3604 KB
subtask_1_9.txt WA 4 ms 3596 KB