/ SeriousOJ /

Record Detail

Accepted


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

Code

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

signed main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    int tc; cin >> tc;

    test:
    while (tc--) {
        ll n; cin >> n;
        
        ll arr[n+1];
        iota(arr, arr+n+1, 0);
        for (ll i = 2; i <= n; i += 2) swap(arr[i], arr[i-1]);
        if (n & 1) swap(arr[n], arr[n-1]);

        for (ll i = 1; i <= n; i++) cout << arr[i] << " ";
        cout << "\n";
    }
}

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