/ SeriousOJ /

Record Detail

Accepted


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

Code

#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;

typedef long long ll;
typedef unsigned long long ull;

typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<string> vs;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef vector<pair<int, int>> vpi;
typedef vector<pair<ll, ll>> vpll;
typedef set<int> si;
typedef set<ll> sll;
typedef set<pair<int, int>> spi;
typedef set<pair<ll, ll>> spll;
typedef multiset<int> msi;
typedef multiset<ll> msll;
typedef multiset<pair<int, int>> mspi;
typedef multiset<pair<ll, ll>> mspll;
typedef map<int, int> mpi;
typedef map<ll, ll> mpll;

typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;  // find_by_order, order_of_key, less, greater,less_equal
typedef tree<ll, null_type, less_equal<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_multiset;

#include<iomanip>
#define fastio  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define e    "\n"
#define yes cout<<"Yes"<<e;
#define no cout<<"No"<<e;
#define pb   push_back
#define ff     first
#define ss    second
#define sz    size()
#define mod 1000000007  //1e9+7  1000000007 998244353
#define fr(i,a,b) for(ll i=a;i<b;i++)
#define fr2(i,a,b) for(ll i=a;i>=b;i--)
#define coutv(v) for(auto it:v)cout<<it<<' ';cout<<e
#define cinv(v) for(auto &it:v)cin>>it
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define Ceil(x,y)  ((x+y-1)/y)
#define INF (1LL<<62)

#define read    freopen("binary.in","r",stdin)
#define write   freopen("cricket.out","w",stdout)

const double PI = acos(-1);
const ll infll = LLONG_MAX;
const ll mn = LLONG_MIN;
const int inf = INT_MAX;

bool cmp1(pair<ll, ll> x1, pair<ll, ll> x2) {
    return x1.ss < x2.ss;
}

bool cmp2(pair<ll, ll> x1, pair<ll, ll> x2) {
    if ( x1.ff == x2.ff ) return x1.ss < x2.ss;
    return x1.ff < x2.ff;
}
bool cmp3(pair<ll, ll> x1, pair<ll, ll> x2) {
    if ( x1.ff == x2.ff ) return x1.ss > x2.ss;
    return x1.ff > x2.ff;
}

bool cmp4(string x1, string x2) {
    return (ll)x1.sz > (ll)x2.sz;
}

void solve() {

}

int main() {
    fastio
    int t = 1, tc = 1;
    cin >> t;

    while ( t-- ) {
        ll n; cin>>n;

        vll ans(n, 0);
        fr(i, 0, n) ans[i]  = i+1;

        for(int i=1; i<n; i+=2) swap( ans[i], ans[i-1] );

        if(n%2 == 1) swap( ans[n-1], ans[n-2] );

        coutv(ans);


    }


    //cout<<"Case "<<tc++<<": "<<ans<<e;

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