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

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

#include <ext/pb_ds/assoc_container.hpp>



#define FOR(i, x, n) for(int i = x; i < n; i++)

#define F0R(i, n) FOR(i, 0, n)

#define ROF(i, x, n) for(int i = n - 1; i >= x; i--)

#define R0F(i, n) ROF(i, 0, n)



#define WTF cout << "WTF" << endl



#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#define F first

#define S second

#define PB push_back

#define EP emplace_back



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

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



using namespace std;



typedef long long LL;

typedef long double LD;



typedef pair<int, int> PII;

typedef pair<LL, LL> PLL;



typedef vector<int> VI;

typedef vector<LL> VLL;

typedef vector<PII> VPII;

typedef vector<PLL> VPLL;



typedef complex<LD> Point;



const int N = 2e5 + 7;

const int INF = 1e9 + 7;

const int LOG = 22;

const int A = 26;

const int SQ = 320;

const int MOD = 1e9 + 7;



mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());



int n, x, y;

int ans[N];



void solve() {

    cin >> n >> x >> y;

    x--; y--;





    if (n & 1) {

        ans[x] = 2;

        FOR(i, x + 1, n) ans[i] = ((x - i) % 2 == 0 ? 1 : 0);

        R0F(i, x) ans[i] = ((x - i) % 2 == 0 ? 0 : 1);

    }



    else {

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

            F0R(i, n) ans[i] = (i & 1);

        }

        else {

            F0R(i, n) ans[i] = (abs(x - i) % 2 == 0 ? 0 : 1);

            ans[x] = 2;

        }

    }



    F0R(i, n) cout << ans[i] << ' ';

    cout << endl;

}



int main() {

    IOS;

    int t; cin >> t;

    while(t--) solve();

}



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

#include <ext/pb_ds/assoc_container.hpp>



#define FOR(i, x, n) for(int i = x; i < n; i++)

#define F0R(i, n) FOR(i, 0, n)

#define ROF(i, x, n) for(int i = n - 1; i >= x; i--)

#define R0F(i, n) ROF(i, 0, n)



#define WTF cout << "WTF" << endl



#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#define F first

#define S second

#define PB push_back

#define EP emplace_back



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

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



using namespace std;



typedef long long LL;

typedef long double LD;



typedef pair<int, int> PII;

typedef pair<LL, LL> PLL;



typedef vector<int> VI;

typedef vector<LL> VLL;

typedef vector<PII> VPII;

typedef vector<PLL> VPLL;



typedef complex<LD> Point;



const int N = 2e5 + 7;

const int INF = 1e9 + 7;

const int LOG = 22;

const int A = 26;

const int SQ = 320;

const int MOD = 1e9 + 7;



mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());



int n, x, y;

int ans[N];



void solve() {

    cin >> n >> x >> y;

    x--; y--;





    if (n & 1) {

        ans[x] = 2;

        FOR(i, x + 1, n) ans[i] = ((x - i) % 2 == 0 ? 1 : 0);

        R0F(i, x) ans[i] = ((x - i) % 2 == 0 ? 0 : 1);

    }



    else {

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

            F0R(i, n) ans[i] = (i & 1);

            ans[x] = 2;

        }

        else {

            F0R(i, n) ans[i] = (abs(x - i) % 2 == 0 ? 0 : 1);

            ans[x] = 2;

        }

    }



    F0R(i, n) cout << ans[i] << ' ';

    cout << endl;

}



int main() {

    IOS;

    int t; cin >> t;

    while(t--) solve();

}