/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 324.0 KiB
#2 Accepted 2ms 532.0 KiB

Code

#include <bits/stdc++.h>
using namespace std;
#define ZORO  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long
#define ll long long

#define f(i,n) for(int i=0; i<n ;i++)
const int M = 9223372036854775807, MOD = 998244353;

bool check(vector<pair<int,int>>v,int r,int c){
    for(auto x:v) {if(x.first != r && x.second != c) return false;}
    return true;
}


void solve(){
    int n;
    cin>>n;
    vector<int>vec;
    if(n%2 == 0){
        for(int i=1; i<=n ;i+=2){
            cout<<i+1<<" ";
            cout<<i<<" ";
        }
        cout<<endl;return;
    }
    if(n == 3){
        cout<<2<<" "<<3<<" "<<1<<endl;
        return;
    }
    for(int i=1; i<n-3;i +=2){
        cout<<i+1<<" ";
        cout<<i<<" ";
    }
    cout<<n-1<<" "<<n<<" "<<n-2<<endl;
}


int32_t main(){
    ZORO


    int tt;
    cin>>tt;
    while(tt--){
        solve();
    }


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