/ SeriousOJ /

Record Detail

Accepted


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

Code

#include <bits/stdc++.h>     //   All praise is due to Allah alone, and peace and blessings be
using namespace std;         //         upon him, after whom there is no other Prophet.

int32_t main() {
    cin.tie(0)->sync_with_stdio(false);

    function<void()> Test_Case = [&]() {
        int n; cin >> n;
        int ar[n];
        iota(ar, ar + n, 1);
        for(int i = 0; i < n - 1; i += 2) {
            swap(ar[i], ar[i + 1]);
        }
        if(n & 1) swap(ar[n - 2], ar[n - 1]);
        for(int i : ar) cout << i << ' '; cout << '\n';
    };

    int32_t Case = 1;    cin >> Case;
    for (int T = 1; T <= Case; T++) {
        Test_Case();
    }
    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:55:23
Judged At
2025-07-14 15:55:23
Judged By
Score
100
Total Time
2ms
Peak Memory
532.0 KiB