Submission #19533935


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];

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

	int limit = 0;
	vector<Int> dp(n + 1, 0);
	dp[0] = 1;

	REP(i, n) {
		int cur = (i + 1) % 2;
		int prev = 1 - cur;
		vector<Int> dp2(2 * limit, 0);		
		REP(j, limit + 1) {
			dp2[j] = dp[j];
			dp2[j] %= MOD;
			dp2[j ^ a[i]] += dp[j];
			dp2[j ^ a[i]] %= MOD;
		}
		limit |= a[i];
		REP(s, limit) dp[s] = dp2[s];
	}
	cout << dp[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 1772 Byte
Status RE
Exec Time 121 ms
Memory 4480 KB

Compile Error

./Main.cpp: In function ‘void solve()’:
./Main.cpp:62:7: warning: unused variable ‘prev’ [-Wunused-variable]
   62 |   int prev = 1 - cur;
      |       ^~~~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 500
Status
RE × 3
RE × 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 RE 118 ms 3348 KB
sample_02.txt RE 117 ms 3184 KB
sample_03.txt RE 118 ms 3216 KB
subtask_1_1.txt RE 118 ms 3304 KB
subtask_1_10.txt RE 117 ms 3356 KB
subtask_1_11.txt RE 118 ms 3152 KB
subtask_1_12.txt RE 117 ms 3200 KB
subtask_1_13.txt RE 118 ms 3268 KB
subtask_1_14.txt RE 118 ms 3196 KB
subtask_1_15.txt RE 112 ms 3144 KB
subtask_1_16.txt RE 111 ms 3320 KB
subtask_1_17.txt RE 115 ms 3376 KB
subtask_1_18.txt RE 119 ms 4124 KB
subtask_1_19.txt RE 117 ms 3548 KB
subtask_1_2.txt RE 113 ms 3144 KB
subtask_1_20.txt RE 114 ms 3148 KB
subtask_1_21.txt RE 114 ms 3320 KB
subtask_1_22.txt RE 112 ms 3184 KB
subtask_1_23.txt RE 119 ms 3372 KB
subtask_1_24.txt RE 114 ms 3308 KB
subtask_1_25.txt RE 121 ms 4480 KB
subtask_1_26.txt RE 117 ms 3152 KB
subtask_1_27.txt RE 117 ms 3332 KB
subtask_1_28.txt RE 115 ms 3312 KB
subtask_1_29.txt RE 118 ms 3320 KB
subtask_1_3.txt RE 115 ms 3264 KB
subtask_1_30.txt RE 116 ms 3304 KB
subtask_1_4.txt RE 111 ms 3324 KB
subtask_1_5.txt RE 116 ms 3308 KB
subtask_1_6.txt RE 116 ms 3796 KB
subtask_1_7.txt RE 114 ms 3408 KB
subtask_1_8.txt RE 114 ms 3336 KB
subtask_1_9.txt RE 114 ms 3348 KB