The 2024 ICPC Kunming Invitational Contest G. Be Positive
https://codeforces.com/gym/105386/problem/G
题目:
结论:
从0开始每四个相邻数的异或值为0
代码:
#include<bits/stdc++.h>
using namespace std;
#define int long long
void solve() {int n;cin >> n;if(n==1||n%4==0){cout << "impossible" << endl;}else{int cnt=2;cout << 1 << ' ' << 0 << ' ';for(int i=2;i<n;){cnt++;if(cnt%4==0){cout << i+1 <<' '<< i << ' ';i+=2;cnt++;}else {cout << i << ' ' ;i++; }}cout << endl;}}
signed main() {int t;cin>>t;while(t--)solve();
}