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

using namespace std;

const int maxn = 1e5 + 5;
const int MAXPWR = 30;

int n;

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

    vector<int> ans(n, 0);

    for (int i = 0; i < n; ++i)
    {
        ans[i] = i;
    }

    if (n <= 3)
    {
        if (n == 1 || n == 3) return ans;
        swap(ans[0], ans[1]);
        return ans;
    }

    int l = 0, r = n - 1;

    if (true)
    {
        int pairs = n / 2;
        int good = (pairs / 2) * 2;

        for (int i = 0; i < good; ++i)
        {
            if (i % 2 == 0)
            {
                ans[l++] = i;
                ans[l++] = n - i - 1;
            }
            else
            {
                ans[r--] = i;
                ans[r--] = n - i - 1;
            }
        }

        if (pairs % 2 == 1)
        {
            ans[l] = r;
            ans[r] = l;
        }
    }

    return ans;
}
