Problem: 2049C - MEX Cycle
Language: C++20 (GCC 13-64)

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

using namespace std;



#define sws std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

#define int long long int

#define float long double

#define ld long double

#define ll long long

#define pb push_back

#define ff first

#define ss second

#define vi vector<int>

#define vpii vector<pair<int, int>> 

#define vvi vector<vector<int>>

#define pii pair<int, int>

#define all(x) x.begin(), x.end()

#define rall(x) x.rbegin(), x.rend()

#define in(v) for(auto & x : v) cin >> x;

#define out(v) for(auto x : v) cout << x << ' ';

#define tiii tuple<int, int, int>

#define tam(x) ((int)x.size())



const int MAX = 3e5+1;

const int INF = INT32_MAX;

int MOD = 1e9+7;

const int LOG = 31;

const ld PI = acos(-1);

const int MINF = INT32_MIN;

vpii dirs = {{1, 0}, {-1, 0}};

vpii dirs1 = {{0, 1}, {0, -1}};



// Contest patrocinado por Summer

// meu primeiro amor santos queridooooooo



void solve() {



    int n, x, y; cin >> n >> x >> y;



    x--; y--;



    vi ans(n, -1);





        ans[x] = 2;

    

        int start = 1;

    

        for(int i = (x + 1) % n; ans[i] == -1; (i+=1)%=n){

    

            ans[i] = start;

    

            start = !(start == 1);

        }



        cout << '\n';

        out(ans);

        cout << '\n';

        return;

    



    if(x % 2 == y % 2) {ans[x] = 2; ans[y] = 3;}



    start = 1;

    int iniPoint = x;



    if(y - x - 1 == 1){



        ans[x + 1] = 0;

        iniPoint = y;

    }



    for(int i = (iniPoint + 1) % n; ans[i] > 2 || ans[i] == -1; (i+=1)%=n){



        if(ans[i] != -1) continue;

        ans[i] = start;



        start = !(start == 1);

    }



    cout << '\n';



    out(ans);

    cout << '\n';

}



int32_t main() { 

    sws;

    int t = 1;

    cin >> t;



    while(t--)

        solve();



return 0;

}

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

using namespace std;



#define sws std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

#define int long long int

#define float long double

#define ld long double

#define ll long long

#define pb push_back

#define ff first

#define ss second

#define vi vector<int>

#define vpii vector<pair<int, int>> 

#define vvi vector<vector<int>>

#define pii pair<int, int>

#define all(x) x.begin(), x.end()

#define rall(x) x.rbegin(), x.rend()

#define in(v) for(auto & x : v) cin >> x;

#define out(v) for(auto x : v) cout << x << ' ';

#define tiii tuple<int, int, int>

#define tam(x) ((int)x.size())



const int MAX = 3e5+1;

const int INF = INT32_MAX;

int MOD = 1e9+7;

const int LOG = 31;

const ld PI = acos(-1);

const int MINF = INT32_MIN;

vpii dirs = {{1, 0}, {-1, 0}};

vpii dirs1 = {{0, 1}, {0, -1}};



// Contest patrocinado por Summer

// meu primeiro amor santos queridooooooo



void solve() {



    int n, x, y; cin >> n >> x >> y;



    x--; y--;



    vi ans(n, -1);



    if(n % 2){



        ans[x] = 2;

    

        int start = 1;

    

        for(int i = (x + 1) % n; ans[i] == -1; (i+=1)%=n){

    

            ans[i] = start;

    

            start = !(start == 1);

        }



        cout << '\n';

        out(ans);

        cout << '\n';

        return;

    }



    if(x % 2 == y % 2) {ans[x] = 2;}



    int start = 1, iniPoint = x;



    for(int i = (iniPoint + 1) % n; ans[i] > 2 || ans[i] == -1; (i+=1)%=n){



        if(ans[i] != -1) continue;

        ans[i] = start;



        start = !(start == 1);

    }



    cout << '\n';



    out(ans);

    cout << '\n';

}



int32_t main() { 

    sws;

    int t = 1;

    cin >> t;



    while(t--)

        solve();



return 0;

}