Problem: 2049C - MEX Cycle
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 2):
#include<iostream>

#include<vector>

using namespace std;

int main(){

    int t;

    cin>>t;

    while(t--){

        int n,x,y;

        cin>>n>>x>>y;

        vector<int>s;

         if(n%2==1){

            int op=0;

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

            if(i==y){s.push_back(2);}

            else{

                s.push_back(op);

                if(op)op=0;

                else op=1;

            }





            }

    

        }

        else{int op=0;

            if(x==1&&y==n){

                

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

              

                    s.push_back(op);

                    if(op)op=0;

                    else op=1;

                

            }}

           else if((y-x)%2==0||y-x==1){

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

                if(i==y){s.push_back(2);}

                else{

                    s.push_back(op);

                   

                }

                    if(op)op=0;

                    else op=1;



            }}

            else{

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

                    if(i==x){

                        s.push_back(op);

                        if(op)op=0;

                        else op=1;

                        i++;i++;

                        s.push_back(2);

                        s.push_back(op);

                        if(op)op=0;

                        else op=1;

                        continue;

                    }

                    if(i==y){s.push_back(2);}

                    else{

                        s.push_back(op);

                       if(op)op=0;

                        else op=1;

                    }

                        

    

                }

            }

    

        }

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

            cout<<s[i]<<" ";

        }

        cout<<endl;

    }

}

Submission (verdict: Wrong answer on test 2):
#include<iostream>

#include<vector>

using namespace std;

int main(){

    int t;

    cin>>t;

    while(t--){

        int n,x,y;

        cin>>n>>x>>y;

        vector<int>s;

         if(n%2==1){

            int op=0;

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

            if(i==y){s.push_back(2);}

            else{

                s.push_back(op);

                if(op)op=0;

                else op=1;

            }





            }

    

        }

        else{int op=0;

            if(x==1&&y==n||(y-x==1)){

                

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

              

                    s.push_back(op);

                    if(op)op=0;

                    else op=1;

                

            }}

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

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

                if(i==y){s.push_back(2);}

                else{

                    s.push_back(op);

                   

                }

                    if(op)op=0;

                    else op=1;



            }}

            else{

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

                    if(i==x){

                        s.push_back(op);

                        if(op)op=0;

                        else op=1;

                        i++;i++;

                        s.push_back(2);

                        s.push_back(op);

                        if(op)op=0;

                        else op=1;

                        continue;

                    }

                    if(i==y){s.push_back(2);}

                    else{

                        s.push_back(op);

                       if(op)op=0;

                        else op=1;

                    }

                        

    

                }

            }

    

        }

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

            cout<<s[i]<<" ";

        }

        cout<<endl;

    }

}