Problem: 2049C - MEX Cycle
Language: c++17 

Solution 1 (runtime: 62 ms):
#include <bits/stdc++.h>

#define int long long

#define endl '\n'

using namespace std;



void solve() { 



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



    if(n&1){

        if((y-x)&1){

            if(y+1 == n+1){

                cout << 2 << " ";

                for(int i=1; i<n; i++) cout << (i&1 ? 1 : 0) << " ";

            }

            else{

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

                    if(i == y+1) {

                        cout << 2 << " ";

                        i++;

                    }

                    else cout << (i&1 ? 0 : 1) << " ";

                }

            }

        }

        else{

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

                if(i == y-1) {

                    cout << 2 << " ";

                    i++;

                }

                else cout << (i&1 ? 0 : 1) << " ";

            }

        }

    }

    else{

        if((y-x)&1){

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

                cout << (i&1 ? 0 : 1) << " ";

            }

        }

        else{

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

                if(i == y) cout << 2 << " ";

                else cout << (i&1 ? 0 : 1) << " ";

            }

        }

    }

    cout << endl;

}



signed main() {

    

    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);/**/

    #ifndef ONLINE_JUDGE 

    freopen("input.in", "r", stdin);

    freopen("output.in", "w", stdout);

    #endif

    

    int T; cin >> T; while(T--) {solve();}

    //solve();



    return 0;

}

Solution 2 (runtime: 93 ms):
#include <bits/stdc++.h>

using namespace std;

#define ll long long

#define lc(t) ll t; cin >> t;

#define f(i,a,n) for (ll i=a; i<n; i++)

#define sp cout << " ";

#define nl cout << "\n";

#define fmc(i,n,a) ll a[n]; for (ll i=0; i<n; i++) cin >> a[i]

#define fout(i,n,a) for (ll i=0; i<n; i++) cout << a[i] << " "

#define pb push_back

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

#define sz(x) (ll)x.size()

#define vi vector<int>

#define vll vector<ll>

#define F first

#define S second

#define endl "\n"

#define mod 1000000007

#define inf 1000000000000000000

#define pi 3.141592653589793238462643383279502884197169399

#define krish ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

#define ld long double

 

bool isprime (ll n)

{

    if (n<=1) return false;

    if(n==2 || n==3) return true;

    if(n%2==0 || n%3==0) return false;

    for (ll i=5; i<=sqrt(n); i+=6)  if (n%i==0 || n%(i+2)==0) return false;

    return true;

}



bool s(pair <string,ll> a, pair <string,ll> b)

{

    return a.second>b.second;

}

 

void fun()

{

    lc(n);

    lc(x);

    lc(y);

    x--, y--;

    if ( n%2==0 )

    {

        f(i,0,n)

        {

            if ( i==x && (x%2)==(y%2) ) cout << "2 ";

            else cout << (i+1)%2 << ' ';

        }

        cout << endl;

        return;

    }

    else

    {

        f(i,0,n-1)

        {

            if ( i==y && (x%2)==(y%2) )

            {

                cout << "2 ";

                if ( y==(n-2) )

                {

                    cout << "0\n";

                    return;

                }

            }

            else cout << (i+1)%2 << ' ';

        }

        cout << "2\n";

        return;

    }

    return;

}

 

int main()

{

    krish;

    lc(t);

    // ll t = 1;

    while (t--) fun();

    return 0;

}