Submission #19534007


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;
	int sum = 0;
	REP(i, n) {
		cin >> a[i];
		sum += a[i];
	}
	sort(a, a + n);

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

	REP(i, n) {
		vector<Int> dp2(limit | a[i], 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 + 1) 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 108 ms
Memory 4744 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 500
Status
WA × 3
AC × 7
WA × 9
RE × 17
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 5 ms 3536 KB
sample_02.txt WA 2 ms 3476 KB
sample_03.txt WA 2 ms 3652 KB
subtask_1_1.txt RE 103 ms 4140 KB
subtask_1_10.txt RE 104 ms 4100 KB
subtask_1_11.txt RE 105 ms 3956 KB
subtask_1_12.txt RE 106 ms 3948 KB
subtask_1_13.txt RE 106 ms 4108 KB
subtask_1_14.txt RE 105 ms 4116 KB
subtask_1_15.txt RE 102 ms 4120 KB
subtask_1_16.txt AC 6 ms 4576 KB
subtask_1_17.txt AC 2 ms 4744 KB
subtask_1_18.txt WA 12 ms 4480 KB
subtask_1_19.txt WA 14 ms 4584 KB
subtask_1_2.txt RE 101 ms 4120 KB
subtask_1_20.txt RE 105 ms 4124 KB
subtask_1_21.txt RE 105 ms 3952 KB
subtask_1_22.txt AC 2 ms 3472 KB
subtask_1_23.txt RE 103 ms 3212 KB
subtask_1_24.txt AC 6 ms 4700 KB
subtask_1_25.txt WA 15 ms 4476 KB
subtask_1_26.txt RE 107 ms 4104 KB
subtask_1_27.txt AC 4 ms 4696 KB
subtask_1_28.txt RE 106 ms 4392 KB
subtask_1_29.txt AC 4 ms 4588 KB
subtask_1_3.txt RE 108 ms 4112 KB
subtask_1_30.txt AC 6 ms 4392 KB
subtask_1_4.txt RE 106 ms 4020 KB
subtask_1_5.txt RE 102 ms 4112 KB
subtask_1_6.txt WA 13 ms 4212 KB
subtask_1_7.txt WA 9 ms 3796 KB
subtask_1_8.txt WA 4 ms 3888 KB
subtask_1_9.txt RE 103 ms 3952 KB