Submission #74714041
Source Code Expand
#include<bits/stdc++.h>
// #include<atcoder/all>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (n); ++i)
template<typename T> bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;}
const long long INF = 1LL << 60;
using Graph = vector<vector<int>>;
int gcd(int a, int b){
if(b == 0) return a;
else return gcd(b, a%b);
}
struct Compare {
bool operator()(const pair<ll, int>& a, const pair<ll, int>& b) {
return a.first > b.first;
}
};
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t; cin >> t;
while(t--){
int n; cin >> n;
vector<int> ans(n);
rep(i,n) ans[i] = i+1;
if(n <= 3){
if(n == 3){
swap(ans[1], ans[2]);
}
}else{
swap(ans[1], ans[2]);
bool change = false;
for(int i = 3;i<n;i+=2){
if(i+1>=n) break;
if(change){
swap(ans[i], ans[i+1]);
change = !change;
}else{
change = !change;
}
}
}
rep(i,n){
cout << ans[i] << " ";
}
cout << "\n";
}
}
Submission Info
| Submission Time | |
|---|---|
| Task | A - Min of Sum of XOR |
| User | motomoto0001 |
| Language | C++23 (GCC 15.2.0) |
| Score | 500 |
| Code Size | 1392 Byte |
| Status | AC |
| Exec Time | 11 ms |
| Memory | 4236 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 500 / 500 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | 00_sample_00.txt |
| All | 00_sample_00.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00_sample_00.txt | AC | 2 ms | 3568 KiB |
| 01_random_00.txt | AC | 10 ms | 4092 KiB |
| 01_random_01.txt | AC | 10 ms | 4156 KiB |
| 01_random_02.txt | AC | 11 ms | 4176 KiB |
| 01_random_03.txt | AC | 10 ms | 4100 KiB |
| 01_random_04.txt | AC | 10 ms | 4236 KiB |
| 01_random_05.txt | AC | 11 ms | 4164 KiB |
| 01_random_06.txt | AC | 11 ms | 4108 KiB |
| 01_random_07.txt | AC | 10 ms | 4196 KiB |
| 01_random_08.txt | AC | 11 ms | 4236 KiB |
| 01_random_09.txt | AC | 11 ms | 4164 KiB |
| 01_random_10.txt | AC | 9 ms | 3696 KiB |
| 01_random_11.txt | AC | 9 ms | 3736 KiB |
| 01_random_12.txt | AC | 9 ms | 3568 KiB |