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

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

// #include<ext/pb_ds/assoc_container.hpp>

// #include<ext/pb_ds/tree_policy.hpp>

using namespace std;

//using namespace __gnu_pbds;

//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds; // find_by_order, order_of_key

#define int long long

#define pb push_back

#define endl '\n'

#define vi vector<int>

const int Mod=1e9+7;

const int N=1e6;

#define ld long double

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

const int MOD = 1e9 + 7;



#define mii map<int, int>

#define vvi vector<vi>

#define rep(i,x,y) for(int i=x; i<y; i++)



 bool primenumber(int n){

     vector<bool> prime(n+1,1);

     prime[0]=0;

     prime[1]=0;

     for(int i =2;i*i<=n;i++){

         if(prime[i]){

             for(int j =i*i;j<=n;j=j+i){

                 prime[j]=0;

                 }}}

     return prime[n];

 }



 int power(int x,int n){

     // calculating the power by binary exponentiation

     int ans=1;

     if(n==0){

         return 1;

     }

     if(n%2 == 0){

         // even power case

    ans=power(x*x,n/2);

     }

     else {

         //odd power case

       ans=x*power(x*x,n/2);

     }

     return ans;

 }



int ncr(int n,int r){

    if(r==0 || r==n) return 1;

    if(r==1) return n;

    int res=1;

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

        res*=(n-i+1);

        res/=(i);

    }

    return res;

}



// factorial

unsigned int factorial(unsigned int n)

{

    if (n == 0 || n == 1)

        return 1;

    return n * factorial(n - 1);

}





// sort the vactor pair based on second element

 bool comp(pair<int, int>& a, pair<int, int>& b){

     return a.second < b.second;

 }

// Function to calculate (base^exponent) % mod

int  modExp(int base, int  exponent, int mod) {

    int result = 1;

    while (exponent > 0) {

        if (exponent % 2 == 1) { 

            result = (result * base) % mod;

        }

        base = (base * base) % mod; 

        exponent /= 2; 

    }

    return result;

}



// Function to calculate (P * Q^-1) % MOD

int calculateModInverse(int P, int Q) {

    int Q_inv = modExp(Q, MOD - 2, MOD); 

    return (P * Q_inv) % MOD;

}



int gcd(int a, int b) {

    while (b != 0) {

        int temp = b;

        b = a % b;

        a = temp;

    }

    return a;

}

void FASTIO() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); }



int32_t main(){

    FASTIO();

    cout<<setprecision(21)<<fixed;



    int t;

    cin>>t;

    while(t--){

        int n,x,y;

        cin>>n>>x>>y;

        vi ans(n,-1);

        ans[x-1]=0;

        ans[y-1]=1;



   if(ans[x%n]==-1)ans[x]=2;

   if(ans[(x-2) %n]==-1)ans[(x-2) %n]=2;

   if(ans[(y-2) %n] ==-1)ans[(y-2) %n]=0;

   if(ans[y%n]==-1)ans[y]=0;

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

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

   }

   for(auto it:ans)cout<<it<<" ";

   cout<<endl;















    

    }

    return 0;

   

}

  

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

// #include<ext/pb_ds/assoc_container.hpp>

// #include<ext/pb_ds/tree_policy.hpp>

using namespace std;

//using namespace __gnu_pbds;

//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds; // find_by_order, order_of_key

#define int long long

#define pb push_back

#define endl '\n'

#define vi vector<int>

const int Mod=1e9+7;

const int N=1e6;

#define ld long double

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

const int MOD = 1e9 + 7;



#define mii map<int, int>

#define vvi vector<vi>

#define rep(i,x,y) for(int i=x; i<y; i++)



 bool primenumber(int n){

     vector<bool> prime(n+1,1);

     prime[0]=0;

     prime[1]=0;

     for(int i =2;i*i<=n;i++){

         if(prime[i]){

             for(int j =i*i;j<=n;j=j+i){

                 prime[j]=0;

                 }}}

     return prime[n];

 }



 int power(int x,int n){

     // calculating the power by binary exponentiation

     int ans=1;

     if(n==0){

         return 1;

     }

     if(n%2 == 0){

         // even power case

    ans=power(x*x,n/2);

     }

     else {

         //odd power case

       ans=x*power(x*x,n/2);

     }

     return ans;

 }



int ncr(int n,int r){

    if(r==0 || r==n) return 1;

    if(r==1) return n;

    int res=1;

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

        res*=(n-i+1);

        res/=(i);

    }

    return res;

}



// factorial

unsigned int factorial(unsigned int n)

{

    if (n == 0 || n == 1)

        return 1;

    return n * factorial(n - 1);

}





// sort the vactor pair based on second element

 bool comp(pair<int, int>& a, pair<int, int>& b){

     return a.second < b.second;

 }

// Function to calculate (base^exponent) % mod

int  modExp(int base, int  exponent, int mod) {

    int result = 1;

    while (exponent > 0) {

        if (exponent % 2 == 1) { 

            result = (result * base) % mod;

        }

        base = (base * base) % mod; 

        exponent /= 2; 

    }

    return result;

}



// Function to calculate (P * Q^-1) % MOD

int calculateModInverse(int P, int Q) {

    int Q_inv = modExp(Q, MOD - 2, MOD); 

    return (P * Q_inv) % MOD;

}



int gcd(int a, int b) {

    while (b != 0) {

        int temp = b;

        b = a % b;

        a = temp;

    }

    return a;

}

void FASTIO() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); }



int32_t main(){

    FASTIO();

    cout<<setprecision(21)<<fixed;



    int t;

    cin>>t;

    while(t--){

        int n,x,y;

        cin>>n>>x>>y;

        vi ans(n,-1);

       x--;

       y--;

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

        ans[(x+i)%n]=i%2;

       }

       if(n%2==1 || (x-y)%2==1)ans[x]=2;

       for(auto it:ans)cout<<it<<" ";

       cout<<endl;





    

    }

    return 0;

   

}