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

Previous submission (verdict: Wrong answer on test 1):
// || =================================================================== ||

// ||                                                                     ||

// ||                   Reach Expert by May 2025                          ||

// ||                                                                     ||

// || =================================================================== ||

#include <bits/stdc++.h>

#define int long long

#define endl "\n";

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

#define ONLINE_JUDGE  

using namespace std;

long long mod_exp(long long base, long long exp, long long mod) {

    long long result = 1;

    while (exp > 0) {

        if (exp % 2 == 1) {

            result = (result * base) % mod;     

        }

        base = (base * base) % mod; 

        exp /= 2; 

    }

    return result;

}

void solve() {

    int n, x, y;

	cin >> n >> x >> y;

	vector<int> ans(n + 1);

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

		if(i & 1){

			ans[i] = 1;

		}else ans[i] = 0;

	}

	if((x == 1 && y == n) || (x == n && y == 1) || min(x, y) + 1 == max(x, y)){

		//nothing happens

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

			cout << ans[i] << " ";

		}

		cout << endl;

		return;

	}

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

		// // here also nothing happens

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

			cout << ans[i] << " ";

		}

		cout << endl;

		return;

	}

	ans[(int)max(x, y)] = 2;

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

		cout << ans[i] << " ";

	}

	cout << endl;

}





signed main(){

    ios_base::sync_with_stdio(false);

    cin.tie(NULL);

    #ifndef ONLINE_JUDGE 

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

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

    #endif  

    int t;

    cin >> t;

    while(t--)

        solve();

   

} 



/*

void solve() {

    int n, k;

    cin >> n >> k;

    int r = n, l  =1;

	stack<pair<int,int>> st;

	st.push({l, r});

	int ans =0LL;

	while(st.size()){

		auto p = st.top();

		st.pop();

		int curL = p.first;

		int curR = p.second;

		if(curR - curL + 1 < k){

			// do nothing

		}else{

			int sz = curR - curL + 1;

			if(sz & 1){

				int m = (curL + curR) / 2LL;

				ans += m;

				cout << "{" << curL << " , " << curR << "} : " << m << endl;

				st.push({curL, m - 1LL});

				st.push({m + 1LL , curR});

			}else{

				int m = (curL + curR) / 2LL;

				st.push({curL, m});

				st.push({m + 1LL , curR});

			}

		}

	}

	cout << ans << endl;

}

 */

Submission (verdict: Wrong answer on test 1):
// || =================================================================== ||

// ||                                                                     ||

// ||                   Reach Expert by May 2025                          ||

// ||                                                                     ||

// || =================================================================== ||

#include <bits/stdc++.h>

#define int long long

#define endl "\n";

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

#define ONLINE_JUDGE  

using namespace std;

long long mod_exp(long long base, long long exp, long long mod) {

    long long result = 1;

    while (exp > 0) {

        if (exp % 2 == 1) {

            result = (result * base) % mod;     

        }

        base = (base * base) % mod; 

        exp /= 2; 

    }

    return result;

}

void solve() {

    int n, x, y;

	cin >> n >> x >> y;

	vector<int> ans(n + 1);

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

		if(i & 1){

			ans[i] = 1;

		}else ans[i] = 0;

	}

	if((x == 1 && y == n) || (x == n && y == 1) || min(x, y) + 1 == max(x, y)){

		//nothing happens

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

			cout << ans[i] << " ";

		}

		cout << endl;

		return;

	}

	// if(((x % 2 == 0) && (y % 2 == 0)) || ((x % 2 == 1) && (y % 2 == 1))){

	// 	// // here also nothing happens

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

	// 		cout << ans[i] << " ";

	// 	}

	// 	cout << endl;

	// 	return;

	// }

	ans[(int)max(x, y)] = 2;

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

		cout << ans[i] << " ";

	}

	cout << endl;

}





signed main(){

    ios_base::sync_with_stdio(false);

    cin.tie(NULL);

    #ifndef ONLINE_JUDGE 

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

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

    #endif  

    int t;

    cin >> t;

    while(t--)

        solve();

   

} 



/*

void solve() {

    int n, k;

    cin >> n >> k;

    int r = n, l  =1;

	stack<pair<int,int>> st;

	st.push({l, r});

	int ans =0LL;

	while(st.size()){

		auto p = st.top();

		st.pop();

		int curL = p.first;

		int curR = p.second;

		if(curR - curL + 1 < k){

			// do nothing

		}else{

			int sz = curR - curL + 1;

			if(sz & 1){

				int m = (curL + curR) / 2LL;

				ans += m;

				cout << "{" << curL << " , " << curR << "} : " << m << endl;

				st.push({curL, m - 1LL});

				st.push({m + 1LL , curR});

			}else{

				int m = (curL + curR) / 2LL;

				st.push({curL, m});

				st.push({m + 1LL , curR});

			}

		}

	}

	cout << ans << endl;

}

 */