/ SeriousOJ /

Record Detail

Accepted


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

Code

#ifndef LOCAL
#include <bits/stdc++.h>
#define debug(...)
#endif

using namespace std;
#define int long long
#define cinv(v) for (auto &it:v) cin>>it;
#define coutv(v) for (auto &it:v) cout<< it<<' '; cout<<'\n';

void shelby() {
    int n;
    cin >> n;
    vector<int> v(n);
    iota(v.begin(), v.end(), 1);
    for (int i = 1; i < n; i += 2) swap(v[i], v[i - 1]);
    if (n % 2) swap(v[n - 1], v[n - 2]);
    coutv(v)
}

signed main() {
    cin.tie(0)->sync_with_stdio(0);
    int t = 1;
    cin >> t;
    for (int _ = 1; _ <= t; ++_) {
        // cout << "Case " << _ << ": ";
        shelby();
    }
}

Information

Submit By
Type
Submission
Problem
P1210 A. Smallest Permutation
Language
C++17 (G++ 13.2.0)
Submit At
2025-07-25 15:11:05
Judged At
2025-07-25 15:11:05
Judged By
Score
100
Total Time
2ms
Peak Memory
532.0 KiB