Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- typedef long long LL;
- typedef long double LD;
- typedef pair<LL,LL> PLL;
- typedef pair<LD,LD> PDD;
- typedef pair<int,int> PII;
- typedef pair<PII,PII> PPII;
- #define PRINT(a) cerr<<#a<<" = "<<(a)<<'\n'
- #define B_E(a) a.begin(), a.end()
- #define PB push_back
- #define MP make_pair
- #define S second
- #define F first
- inline void file() {
- #ifdef _WIN32
- srand(time(NULL));
- return;
- #endif
- ios_base::sync_with_stdio(false);
- cin.tie(NULL);
- cout.tie(NULL);
- if (0) {
- freopen(".in", "r", stdin);
- freopen(".out", "w", stdout);
- }
- }
- const clock_t MAXT = (100*CLOCKS_PER_SEC)/1000;
- const int PX[8] = {1,0,-1,0, 1,1,-1,-1},
- PY[8] = {0,1,0,-1, -1,1,1,-1},
- N = 1e5 + 10,
- INF = 1e9,
- MOD = 1e9 + 7;
- const LL INFL = 1e18,
- MODL = 1e9 + 7;
- const LD EPS = 1e-9;
- inline int rnd(int l = 0, int r = INF) {
- unsigned ans = rand();
- ans = (ans<<8) ^ rand();
- ans = (ans<<8) ^ rand();
- ans = (ans<<8) ^ rand();
- ans %= r-l+1;
- return int(ans + l);
- }
- int n,x,check;
- set<int> s;
- main()
- { file();
- cin>>n>>x;
- if ( n == 1 ) {
- cout<<"YES\n"<<x<<'\n';
- return 0;
- }
- if ( n == 2 && !x ) {
- cout<<"NO\n";
- return 0;
- }
- cout<<"YES\n";
- if ( n == 2 ) {
- int m = 1000*1000;
- for (int i=0; i<=m; ++i)
- if ( (i^x) != i ) {
- cout<<(i^x)<<' '<<i;
- return 0;
- }
- }
- int m = 1<<19;
- while ( n >= 5 ) {
- cout<<m<<' '<<m+1<<' ';
- check ^= m ^ (m+1);
- x ^= 1;
- m += 2;
- n -= 2;
- }
- /// n = 3, 4
- m = 1<<19;
- cout<<x+(3<<17)<<' '; check ^= x+(3<<17);
- cout<<(1<<17)<<' '; check ^= 1<<17;
- cout<<(2<<17)<<' '; check ^= 2<<17;
- if ( n == 4 )
- cout<<0;
- cerr<<"\n\t"<<check;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement