/ SeriousOJ /

Record Detail

Accepted


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

Code

// Created: 2025-07-14 20:31:18 IST
#include<bits/stdc++.h>
// #include<ext/pb_ds/assoc_container.hpp>
// #include<ext/pb_ds/tree_policy.hpp>
using namespace std;
// using namespace __gnu_pbds;
// #define int long long
#define ll long long
#define cout cout<<fixed<<setprecision(0)
#define pb push_back
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define f(a,n) for(int i=0; i<n; i++){ cin>>a[i]; }
#define ff(a,l,n) for(int i=l; i<=n; i++){ cin>>a[i]; }
#define vvi vector<vector<int>>
#define vi vector<int>
#define all(a) (a).begin(), (a).end()
#define minpq priority_queue<ll, vector<ll>, greater<ll>> ;
mt19937_64 RNG(chrono::steady_clock::now().time_since_epoch().count());

void solve(){
    int n; cin>>n;
    vi ans;
    for(int  i=0; i<n/2; ++i){
        ans.pb(2*(i+1));
        ans.pb(2*i+1);
    }
    if(n%2){
        ans.pop_back();
        ans.pb(n);
        ans.pb(n-2);
    }
    for(int i=0; i<n; ++i){
        cout<<ans[i]<<" ";
    }
    cout<<endl;

}

int32_t main() 
{
    auto begin = std::chrono::high_resolution_clock::now();
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    // solve();
    int t; cin>>t;
    for(int i=0; i<t; i++){
        solve();
    }
    
    auto end = std::chrono::high_resolution_clock::now();
    auto elapsed = std::chrono::duration_cast<std::chrono::nanoseconds>(end - begin);
    // cerr << "Time measured: " << elapsed.count() * 1e-9 << " seconds.\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 16:15:26
Judged At
2025-07-14 16:15:26
Judged By
Score
100
Total Time
2ms
Peak Memory
532.0 KiB