Code
#include<bits/stdc++.h>
using namespace std;
int main()
{
int T;
cin>>T;
while(T--)
{
int N;
cin>>N;
vector<int>v1;
for(int i=1; i<N; i+=2)
{
v1.push_back(i+1);
v1.push_back(i);
}
if(N%2==0)
{
for(auto x:v1)
{
cout<<x<<" ";
}
}
else
{
v1.push_back(N);
swap(v1[N-2],v1[N-1]);
for(auto x:v1)
{
cout<<x<<" ";
}
}
}
}
Information
- Submit By
- Type
- Submission
- Problem
- P1210 A. Smallest Permutation
- Contest
- Educational Round 1
- Language
- C++17 (G++ 13.2.0)
- Submit At
- 2025-07-14 16:12:47
- Judged At
- 2025-07-14 16:12:47
- Judged By
- Score
- 100
- Total Time
- 2ms
- Peak Memory
- 532.0 KiB