Codeforces
CF Step
Youtube Linkedin Discord Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

Code: The 67th Permutation Problem

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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    long long test = 1;
    cin >> test;
    bool submit = true;
    if (test >= 10010010)
        submit = false;
    if (test == 1)
        submit = true;

    while (test--) {
        int N;
        cin >> N;
        vector<int> answer;
        int low = 1, high = 3 * N;
        for (int i = 0; i < N; i++) {
            answer.push_back(high--);
            answer.push_back(high--);
            answer.push_back(low++);
        }
        for (auto a : answer)
            cout << a << " ";
        cout << "\n";
    }
}