fork(1) download
  1. #include<iostream>
  2. using namespace std;
  3. long long n,k,a[100],cnt,fact[21];
  4. int main(){
  5. cin>>n>>k;for(int i=0;i<n;i++)cin>>a[i];
  6. fact[1]=1;for(int i=2;i<=20;i++){fact[i]=fact[i-1]*i;fact[i]%=1000000007;}
  7. for(int i=1;i<(1<<n);i++){
  8. int r=0,s=0;for(int j=0;j<n;j++){if((i/(1<<j))%2==1){s++;r^=a[j];}}
  9. if(r==k){cnt+=fact[s];cnt%=1000000007;}
  10. }
  11. cout<<cnt<<endl;
  12. return 0;
  13. }
Success #stdin #stdout 0s 3472KB
stdin
3 2
1 2 3
stdout
3