Submission #19533784


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 dp[cur]);
		for (int j = 0; j <= limit; j++) {
			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 1779 Byte
Status TLE
Exec Time 2205 ms
Memory 5340 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 500
Status
AC × 3
AC × 32
TLE × 1
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 8 ms 5144 KB
sample_02.txt AC 3 ms 5064 KB
sample_03.txt AC 4 ms 5096 KB
subtask_1_1.txt AC 3 ms 5140 KB
subtask_1_10.txt AC 27 ms 5104 KB
subtask_1_11.txt AC 11 ms 4976 KB
subtask_1_12.txt AC 7 ms 5140 KB
subtask_1_13.txt AC 7 ms 5100 KB
subtask_1_14.txt AC 4 ms 5100 KB
subtask_1_15.txt AC 5 ms 5032 KB
subtask_1_16.txt AC 4 ms 5040 KB
subtask_1_17.txt AC 2 ms 5100 KB
subtask_1_18.txt AC 1605 ms 5340 KB
subtask_1_19.txt AC 951 ms 5284 KB
subtask_1_2.txt AC 5 ms 5112 KB
subtask_1_20.txt AC 25 ms 5044 KB
subtask_1_21.txt AC 20 ms 5044 KB
subtask_1_22.txt AC 2 ms 4320 KB
subtask_1_23.txt AC 2 ms 4312 KB
subtask_1_24.txt AC 2 ms 4292 KB
subtask_1_25.txt TLE 2205 ms 5176 KB
subtask_1_26.txt AC 22 ms 4980 KB
subtask_1_27.txt AC 2 ms 4300 KB
subtask_1_28.txt AC 4 ms 5072 KB
subtask_1_29.txt AC 3 ms 5068 KB
subtask_1_3.txt AC 5 ms 5072 KB
subtask_1_30.txt AC 3 ms 5096 KB
subtask_1_4.txt AC 3 ms 5036 KB
subtask_1_5.txt AC 3 ms 5036 KB
subtask_1_6.txt AC 1081 ms 5128 KB
subtask_1_7.txt AC 284 ms 5192 KB
subtask_1_8.txt AC 59 ms 5044 KB
subtask_1_9.txt AC 30 ms 5104 KB