/ SeriousOJ /

Record Detail

Accepted


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

Code

/**
*    In the name of Allah
*    We are nothing and you're everything
*    Ya Muhammad!
**/
#include <bits/stdc++.h>
 
using namespace std;
using ll = long long;
using ull = uint64_t;
 
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
//#define int long long
 
const char nl = '\n';
const int N = 1e5+5;
const ll inf = 0x3f3f3f3f3f3f3f3fll;

void solve() {
    int n; cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; ++i)a[i] = i+1;
    
    for (int i = 0; i < n-1; i += 2)swap(a[i], a[i+1]);
    if (n&1)swap(a[n-1], a[n-2]);
    for (auto i: a)cout << i << " ";
    cout << nl;
}

int32_t main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int t; cin >> t;
    while(t--)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:38:05
Judged At
2025-07-14 15:38:05
Judged By
Score
100
Total Time
2ms
Peak Memory
532.0 KiB