Code
#include <iostream>
using namespace std;
int t,n;
int main()
{
cin>>t;
while (t)
{
t--;
cin>>n;
if (n%2==0)
{
for (int i=1; i<=n; i++)
if (i%2==1) cout<<i+1<<" ";
else cout<<i-1<<" ";
}
else
{
for (int i=1; i<=n-3; i++)
if (i%2==1) cout<<i+1<<" ";
else cout<<i-1<<" ";
cout<<n-1<<" "<<n<<" "<<n-2;
}
cout<<'\n';
}
return 0;
}
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 15:32:42
- Judged At
- 2025-07-14 15:32:42
- Judged By
- Score
- 100
- Total Time
- 2ms
- Peak Memory
- 532.0 KiB