SHARE
TWEET

Untitled

a guest Jun 3rd, 2019 2,155 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <vector>
  3. using namespace std;
  4. bool ex[(1<<18)];
  5. int main()
  6. {
  7.     int n,x;
  8.     scanf("%d%d",&n,&x);
  9.     ex[0]=1;
  10.     vector<int> v({0});
  11.     for (int i=1;i<(1<<n);i++)
  12.     {
  13.         if (ex[i^x])
  14.         continue;
  15.         v.push_back(i);
  16.         ex[i]=1;
  17.     }
  18.     printf("%d\n",v.size()-1);
  19.     for (int i=1;i<v.size();i++)
  20.     printf("%d ",(v[i]^v[i-1]));
  21. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top