Advertisement
Guest User

Untitled

a guest
Sep 19th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.90 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. typedef long long LL;
  4. typedef long double LD;
  5. typedef pair<LL,LL> PLL;
  6. typedef pair<LD,LD> PDD;
  7. typedef pair<int,int> PII;
  8. typedef pair<PII,PII> PPII;
  9. #define PRINT(a) cerr<<#a<<" = "<<(a)<<'\n'
  10. #define B_E(a) a.begin(), a.end()
  11. #define PB push_back
  12. #define MP make_pair
  13. #define S second
  14. #define F first
  15. inline void file() {
  16.     #ifdef _WIN32
  17.         srand(time(NULL));
  18.         return;
  19.     #endif
  20.  
  21.     ios_base::sync_with_stdio(false);
  22.     cin.tie(NULL);
  23.     cout.tie(NULL);
  24.  
  25.     if (0) {
  26.         freopen(".in",  "r", stdin);
  27.         freopen(".out", "w", stdout);
  28.     }
  29. }
  30.  
  31.  
  32.  
  33.  
  34.  
  35. const clock_t MAXT = (100*CLOCKS_PER_SEC)/1000;
  36. const int   PX[8] = {1,0,-1,0,  1,1,-1,-1},
  37.             PY[8] = {0,1,0,-1,  -1,1,1,-1},
  38.             N = 1e5 + 10,
  39.             INF = 1e9,
  40.             MOD = 1e9 + 7;
  41. const LL    INFL = 1e18,
  42.             MODL = 1e9 + 7;
  43. const LD    EPS = 1e-9;
  44.  
  45. inline int rnd(int l = 0, int r = INF) {
  46.     unsigned ans = rand();
  47.     ans = (ans<<8) ^ rand();
  48.     ans = (ans<<8) ^ rand();
  49.     ans = (ans<<8) ^ rand();
  50.     ans %= r-l+1;
  51.     return int(ans + l);
  52. }
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59. int n,x,check;
  60. set<int> s;
  61.  
  62.  
  63. main()
  64. { file();
  65.  
  66.     cin>>n>>x;
  67.     if ( n == 1 ) {
  68.         cout<<"YES\n"<<x<<'\n';
  69.         return 0;
  70.     }
  71.  
  72.  
  73.     if ( n == 2 && !x ) {
  74.         cout<<"NO\n";
  75.         return 0;
  76.     }
  77.  
  78.     cout<<"YES\n";
  79.     if ( n == 2 ) {
  80.         int m = 1000*1000;
  81.         for (int i=0; i<=m; ++i)
  82.         if ( (i^x) != i ) {
  83.             cout<<(i^x)<<' '<<i;
  84.             return 0;
  85.         }
  86.     }
  87.  
  88.     int m = 1<<19;
  89.     while ( n >= 5 ) {
  90.         cout<<m<<' '<<m+1<<' ';
  91.         check ^= m ^ (m+1);
  92.         x ^= 1;
  93.         m += 2;
  94.         n -= 2;
  95.     }
  96.  
  97.     /// n = 3, 4
  98.     m = 1<<19;
  99.  
  100.     cout<<x+(3<<17)<<' '; check ^= x+(3<<17);
  101.     cout<<(1<<17)<<' ';   check ^= 1<<17;
  102.     cout<<(2<<17)<<' ';   check ^= 2<<17;
  103.     if ( n == 4 )
  104.         cout<<0;
  105.  
  106.     cerr<<"\n\t"<<check;
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement