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

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



using namespace std;



template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); }

#ifdef LOCAL

#define dbg(...) cerr << 

 << #__VA_ARGS__ << 

#else

#define dbg(...)

#endif



#define vi vector<int>

#define int long long

#define ld long double

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

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



const int MAX_N = 1e5 + 5;

const int MOD = 1e9 + 7;

const int INF = 1e9;

const ld EPS = 1e-9;







void solve() {

        int n , x , y;

        cin >> n >> x >> y;

        x-- , y--;



        vi a(n , -1);





        if(n % 2 == 0) {

                bool f = true;

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

                        if(f)

                                a[i] = 1;

                        else a[i] = 0;

                        f = !f;

                }

                f = false;

                for(int i=x-1;i>=0;i--) {

                        if(f) a[i] = 0;

                        else a[i] = 1;

                        f = !f;

                }



                for(auto &i : a) cout << i << " ";

                cout << endl;

                return ;

        }



        

        a[x] = 2;

        a[y] = 1;

        bool f = true;

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

                if(i == y) {

                        f = false;

                        continue;

                }

                if(f) a[i] = 1;

                else a[i] = 0;

                f = !f;

        }

        for(int i=x-1;i>=0;i--) {

                if(i == y) {

                        f = false;

                        continue;

                }

                if(f) a[i] = 1;

                else a[i] = 0;

                f = !f;

        }



        for(auto &i : a) cout << i << " ";

        cout << endl;

}

signed main() {

ios_base::sync_with_stdio(false);

cin.tie(NULL);

  int tc = 1;

  cin >> tc;

  for (int t = 1; t <= tc; t++) {

      solve();

  }

}

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



using namespace std;



template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); }

#ifdef LOCAL

#define dbg(...) cerr << 

 << #__VA_ARGS__ << 

#else

#define dbg(...)

#endif



#define vi vector<int>

#define int long long

#define ld long double

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

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



const int MAX_N = 1e5 + 5;

const int MOD = 1e9 + 7;

const int INF = 1e9;

const ld EPS = 1e-9;







void solve() {

        int n , x , y;

        cin >> n >> x >> y;

        x-- , y--;



        vi a(n , -1);





        if(n % 2 == 0) {

                bool f = true;

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

                        if(f)

                                a[i] = 1;

                        else a[i] = 0;

                        f = !f;

                }

                f = false;

                for(int i=x-1;i>=0;i--) {

                        if(f) a[i] = 0;

                        else a[i] = 1;

                        f = !f;

                }



                for(auto &i : a) cout << i << " ";

                cout << endl;

                return ;

        }



        

        a[x] = 2;

        a[y] = 1;

        bool f = true;

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

                if(i == y) {

                        f = false;

                        continue;

                }

                if(f) a[i] = 0;

                else a[i] = 1;

                f = !f;

        }

        for(int i=x-1;i>=0;i--) {

                if(i == y) {

                        f = false;

                        continue;

                }

                if(f) a[i] = 1;

                else a[i] = 0;

                f = !f;

        }



        for(auto &i : a) cout << i << " ";

        cout << endl;

}

signed main() {

ios_base::sync_with_stdio(false);

cin.tie(NULL);

  int tc = 1;

  cin >> tc;

  for (int t = 1; t <= tc; t++) {

      solve();

  }

}