#include "partition.h"
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

vector<int> solve(vector<int> A) {
    int n = A.size();
    vector<int> rez;

    if (n % 4 == 0) {
        for (int i = 0; i < n/2; i++) {
            rez.push_back(i);
            rez.push_back(n - i - 1);
        }
    } else if (n % 4 == 1) {
        for (int i = 0; i < n/2; i++) {
            rez.push_back(i);
            rez.push_back(n - i - 1);
        }
        rez.push_back(n/2);
        reverse(rez.begin(), rez.end());
    } else if (n % 4 == 2) {
        for (int i = 0; i < n/4; i++) {
            rez.push_back(i);
            rez.push_back(n - i - 1);
        }
        rez.push_back(n/2 - 1);
        for (int i = n/4; i < n/2 - 1; i++) {
            rez.push_back(i);
            rez.push_back(n - i - 1);
        }
        rez.push_back(n/2);
    } else {
        for (int i = 0; i < n/4; i++) {
            rez.push_back(i);
            rez.push_back(n - i - 1);
        }
        rez.push_back(n/2 - 1);
        for (int i = n/4; i < n/2 - 1; i++) {
            rez.push_back(i);
            rez.push_back(n - i - 1);
        }
        rez.push_back(n/2);
        rez.push_back(n/2 + 1);
        reverse(rez.begin(), rez.end());
    }

    return rez;
}
