fork(1) download
  1. #include<iostream>
  2. using namespace std;
  3. const long long mod = 1000000007LL;
  4. long long n, k, a[102], dp[102][256][102], fact[102], sum;
  5. int main() {
  6. cin >> n >> k; for (int i = 0; i < n; i++)cin >> a[i];
  7. dp[0][0][0] = 1;
  8. fact[1] = 1; for (int i = 2; i <= 100; i++) { fact[i] = fact[i - 1] * i; fact[i] %= mod; }
  9. for (int i = 0; i < n; i++) {
  10. for (int j = 0; j < 256; j++) {
  11. for (int k = 0; k < n; k++) {
  12. if (dp[i][j][k] == 0)continue;
  13. dp[i + 1][j^a[i]][k + 1] += dp[i][j][k]; dp[i + 1][j^a[i]][k + 1] %= mod;
  14. dp[i + 1][j][k] += dp[i][j][k]; dp[i + 1][j][k] %= mod;
  15. }
  16. }
  17. }
  18. for (int i = 1; i <= n; i++) { sum += dp[n][k][i] * fact[i]; sum %= mod; }
  19. cout << sum << endl;
  20. return 0;
  21. }
Success #stdin #stdout 0s 24280KB
stdin
3 2
1 2 3
stdout
3