/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Wrong Answer 1ms 532.0 KiB
#2 Wrong Answer 2ms 532.0 KiB

Code

#include<bits/stdc++.h>
using namespace std;
#define int             long long
#define pb              push_back
#define endl            '\n'
#define debug           cout<<"HERE"<<endl;
#define ff              first
#define ss              second
void edm()
{
    ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
}
void solve()
{
    int n;cin>>n;
    if(n==3)
    {
        cout<<2<<" "<<1<<" "<<3<<endl;
        return;
    }
    cout<<2<<" "<<1<<" ";
    if(n%2==0)
    {
        for(int i=3;i<=n;i+=2)
        {
            cout<<i+1<<" "<<i<<" ";
        }
        cout<<endl;
        return;
    }
    else
    {
        for(int i=3;i<n-2;i+=2)
        {
            cout<<i+1<<" "<<i<<" ";
        }
        cout<<n-1<<" "<<n<<" "<<n-2;
        cout<<endl;
        return;
    }
    cout<<endl;
}
signed main()
{
    //edm();
    int t = 1;
    cin>>t;
    for(int i=1;i<=t;i++)
    {
        ///cout<<"Case "<<i<<": ";
        solve();
    }
} 

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:35:01
Judged At
2025-07-14 15:35:01
Judged By
Score
0
Total Time
2ms
Peak Memory
532.0 KiB