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

Submission #19372559

Source Code Expand

Copy
#include <bits/stdc++.h>
using namespace std;
const long long int MOD = 1e9 + 7;

int main(){
int n, k;
cin >> n >> k;

map<int,int> table;
for(int i=0; i<n; i++){
int a;
cin >> a;

table[a] += 1;
}

vector<long long int> pow2(n+1);
pow2[0] = 1;
for(int i=0; i<n; i++){
pow2[i+1] = pow2[i] * 2;
pow2[i+1] %= MOD;
}

int m = table.size();// < 500 since (1+500) * 500 / 2 > 1e5
vector<vector<long long int>> dp(m+1,vector<long long int>(1<<17));
dp[0][0] = 1;
int i = 0;
for(auto t : table){
int x = t.first;
int num = t.second;

for(int j=0; j<(1<<17); j++){
dp[i+1][j] += dp[i][j] * pow2[num-1];// nC0 + nC2 + ... = [(1+1)^n + (1+(-1))^n] / 2 = 2^{n-1}
dp[i+1][j] %= MOD;

dp[i+1][j^x] += dp[i][j] * pow2[num-1];// nC1 + nC3 + ... = [(1+1)^n - (1+(-1))^n] / 2 = 2^{n-1}
dp[i+1][j^x] %= MOD;
}
i += 1;
}
cout << dp[m][k] << endl;
return 0;
}

#### Submission Info

Submission Time 2021-01-11 13:46:19+0900 F - Limited Xor Subset probably C++ (GCC 9.2.1) 0 1078 Byte MLE 480 ms 463796 KB

#### Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 500
Status
 AC × 3
 AC × 31 MLE × 2
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
Case Name Status Exec Time Memory
sample_01.txt AC 11 ms 7272 KB
sample_02.txt AC 6 ms 6208 KB
sample_03.txt AC 14 ms 12308 KB
subtask_1_1.txt AC 19 ms 18372 KB
subtask_1_10.txt AC 35 ms 27620 KB
subtask_1_11.txt AC 34 ms 29660 KB
subtask_1_12.txt AC 28 ms 23776 KB
subtask_1_13.txt AC 33 ms 24692 KB
subtask_1_14.txt AC 24 ms 20608 KB
subtask_1_15.txt AC 21 ms 18312 KB
subtask_1_16.txt AC 15 ms 13300 KB
subtask_1_17.txt AC 11 ms 7272 KB
subtask_1_18.txt AC 19 ms 7796 KB
subtask_1_19.txt AC 13 ms 7488 KB
subtask_1_2.txt AC 21 ms 18496 KB
subtask_1_20.txt MLE 475 ms 463728 KB
subtask_1_21.txt MLE 480 ms 463796 KB
subtask_1_22.txt AC 11 ms 6216 KB
subtask_1_23.txt AC 5 ms 6212 KB
subtask_1_24.txt AC 6 ms 6236 KB
subtask_1_25.txt AC 26 ms 7028 KB
subtask_1_26.txt AC 13 ms 6160 KB
subtask_1_27.txt AC 8 ms 6172 KB
subtask_1_28.txt AC 8 ms 8012 KB
subtask_1_29.txt AC 6 ms 7264 KB
subtask_1_3.txt AC 26 ms 20552 KB
subtask_1_30.txt AC 7 ms 7228 KB
subtask_1_4.txt AC 26 ms 18316 KB
subtask_1_5.txt AC 26 ms 17588 KB
subtask_1_6.txt AC 16 ms 9596 KB
subtask_1_7.txt AC 30 ms 21528 KB
subtask_1_8.txt AC 109 ms 107988 KB
subtask_1_9.txt AC 268 ms 257092 KB