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

Submission #19372833

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<long long int> dp(1<<17);
dp[0] = 1;
int i = 0;
for(auto t : table){
int x = t.first;
int num = t.second;
vector<long long int> dp_new(1<<17);

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

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

#### Submission Info

Submission Time 2021-01-11 14:02:03+0900 F - Limited Xor Subset probably C++ (GCC 9.2.1) 500 1083 Byte AC 224 ms 6156 KB

#### Compile Error

```./Main.cpp: In function ‘int main()’:
./Main.cpp:24:9: warning: unused variable ‘m’ [-Wunused-variable]
24 |     int m = table.size();// < 500 since (1+500) * 500 / 2 > 1e5
|         ^
./Main.cpp:27:9: warning: unused variable ‘i’ [-Wunused-variable]
27 |     int i = 0;
|         ^
```

#### Judge Result

Set Name Sample All
Score / Max Score 0 / 0 500 / 500
Status
 AC × 3
 AC × 33
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
Case Name Status Exec Time Memory
sample_01.txt AC 10 ms 5156 KB
sample_02.txt AC 7 ms 5204 KB
sample_03.txt AC 19 ms 5188 KB
subtask_1_1.txt AC 20 ms 5184 KB
subtask_1_10.txt AC 24 ms 5520 KB
subtask_1_11.txt AC 21 ms 5544 KB
subtask_1_12.txt AC 17 ms 5540 KB
subtask_1_13.txt AC 25 ms 5212 KB
subtask_1_14.txt AC 16 ms 5204 KB
subtask_1_15.txt AC 17 ms 5184 KB
subtask_1_16.txt AC 14 ms 5600 KB
subtask_1_17.txt AC 6 ms 5368 KB
subtask_1_18.txt AC 23 ms 5820 KB
subtask_1_19.txt AC 14 ms 5540 KB
subtask_1_2.txt AC 14 ms 5132 KB
subtask_1_20.txt AC 224 ms 5568 KB
subtask_1_21.txt AC 218 ms 5480 KB
subtask_1_22.txt AC 6 ms 5212 KB
subtask_1_23.txt AC 7 ms 5236 KB
subtask_1_24.txt AC 5 ms 5184 KB
subtask_1_25.txt AC 26 ms 6156 KB
subtask_1_26.txt AC 5 ms 5208 KB
subtask_1_27.txt AC 6 ms 5132 KB
subtask_1_28.txt AC 9 ms 5204 KB
subtask_1_29.txt AC 12 ms 5288 KB
subtask_1_3.txt AC 16 ms 5208 KB
subtask_1_30.txt AC 7 ms 5292 KB
subtask_1_4.txt AC 19 ms 5368 KB
subtask_1_5.txt AC 19 ms 5644 KB
subtask_1_6.txt AC 18 ms 5536 KB
subtask_1_7.txt AC 25 ms 5628 KB
subtask_1_8.txt AC 62 ms 5556 KB
subtask_1_9.txt AC 128 ms 5188 KB