Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #define ll long long
- #define ul unsigned long long
- #define ld long double
- #define vll(v) vector<ll>v
- //#define vll(v,n) vector<ll>v(n);
- #define mll(m) map<ll,ll>m;
- #define sll(s) set<ll>s;
- #define iv(v) for(auto &i:v) cin >> i;
- #define ov(v) for(auto &i:v) cout << i << " ";
- #define all(v) (v.begin(),v.end());
- #define Bismillah ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
- using namespace std;
- string toBin(ll n) {
- string s;
- while (n) {
- s.push_back(n%2+'0');
- n/=2;
- }
- reverse(s.begin(), s.end());
- return s;
- }
- ll toDec(string s) {
- reverse(s.begin(), s.end());
- ll n=0;
- for (int i=0; i<s.size(); i++) {
- n+=(s[i]-'0') * (1<<i);
- }
- return n;
- }
- void solve() {
- ll n,x;
- cin >> n >> x;
- if (n==2 && x==0) {
- cout << "NO"; return;
- }
- cout << "YES" << endl;
- if (n==1) cout << x;
- else if (n==2) cout << 1 << " " << (x^1);
- else {
- ll xr=x;
- for (ll i=1; i<n; i++) {
- xr^=i;
- }
- for (ll i=n-1; i>0; i--) {
- if (i!=xr) {
- for (int j=1; j<n; j++) {
- if (j==i) j+=(1<<18);
- cout << j << ' ';
- }
- cout << xr+(1<<18);
- break;
- }
- }
- }
- }
- int main() {
- Bismillah
- ll t=1;
- // cin >> t;
- while (t--) {
- solve();
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment