Problem: 2049C - MEX Cycle
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>



#define int long long

#define endl '\n'



using namespace std;



void sorter(vector<int> &x){

    sort(x.begin(), x.end());

}



void rsorter(vector<int> &x){

    sort(x.rbegin(), x.rend());

}



struct custom_hash {

    static uint64_t splitmix64(uint64_t x) {

        // http://xorshift.di.unimi.it/splitmix64.c

        x += 0x9e3779b97f4a7c15;

        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;

        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;

        return x ^ (x >> 31);

    }



    size_t operator()(uint64_t x) const {

        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();

        return splitmix64(x + FIXED_RANDOM);

    }

};







void solve(){

    int n,x,y;

    cin>>n>>x>>y;

    int off=0;

    if(n%2){

        for(int i=1;i<=n;i++){

            if(i==x){

                cout<<2<<" ";

                off=1;

            }

            else{

                cout<<(i+off)%2<<" ";

            }

        }

    }

    else{

        if((y-x)%2==0){

            for(int i=1;i<=n;i++){

                if(i==x){

                cout<<2<<" ";

                off=1;

            }

            else{

                cout<<(i+off)%2<<" ";

            }

            }

        }

        else{

            for(int i=1;i<=n;i++) cout<<i%2<<" ";

        }

    }

    cout<<endl;

}



int32_t main() {    

    // fast io

    ios_base::sync_with_stdio(false);

    cin.tie(NULL);

    int t=1;

    cin>>t;

    while(t--){

        solve();

    }

}

Submission (verdict: Accepted):
#include <bits/stdc++.h>



#define int long long

#define endl '\n'



using namespace std;



void sorter(vector<int> &x){

    sort(x.begin(), x.end());

}



void rsorter(vector<int> &x){

    sort(x.rbegin(), x.rend());

}



struct custom_hash {

    static uint64_t splitmix64(uint64_t x) {

        // http://xorshift.di.unimi.it/splitmix64.c

        x += 0x9e3779b97f4a7c15;

        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;

        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;

        return x ^ (x >> 31);

    }



    size_t operator()(uint64_t x) const {

        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();

        return splitmix64(x + FIXED_RANDOM);

    }

};







void solve(){

    int n,x,y;

    cin>>n>>x>>y;

    int off=0;

    if(n%2){

        for(int i=1;i<=n;i++){

            if(i==x){

                cout<<2<<" ";

                off=1;

            }

            else{

                cout<<(i+off)%2<<" ";

            }

        }

    }

    else{

        if((y-x)%2==0){

            for(int i=1;i<=n;i++){

                if(i==x){

                cout<<2<<" ";

            }

            else{

                cout<<(i+off)%2<<" ";

            }

            }

        }

        else{

            for(int i=1;i<=n;i++) cout<<i%2<<" ";

        }

    }

    cout<<endl;

}



int32_t main() {    

    // fast io

    ios_base::sync_with_stdio(false);

    cin.tie(NULL);

    int t=1;

    cin>>t;

    while(t--){

        solve();

    }

}