/ SeriousOJ /

Record Detail

Accepted


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

Code

#include <bits/stdc++.h>
#define int long long
using namespace std;

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int t;
    cin >> t;
    while (t--)
    {
        int n;
        cin >> n;
        vector<int> arr(n);
        for (int i = 0; i < n; i++)
            arr[i] = i + 1;
        int i = 0;
        while (i + 1 < n)
        {
            if (i + 1 < n)
            {
                swap(arr[i], arr[i + 1]);
            }
            i += 2;
        }

        if (i < n)
            swap(arr[i], arr[i - 1]);
        for (auto a : arr)
            cout << a << " ";
        cout << endl;
    }
    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:34:02
Judged At
2025-07-14 15:34:02
Judged By
Score
100
Total Time
2ms
Peak Memory
532.0 KiB