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

using namespace std;
const int nmax = 2e6;
struct ura
{
    int ord, val;
}v[nmax + 1];
bool cmp(ura a, ura b)
{
    if(a.val < b.val)
        return true;
    if(a.val > b.val)
        return false;
    return a.ord < b.ord;
}
std::vector<int> solve(std::vector<int> A)
{
    int n = A.size(), i, j, k;
    vector <int> sol(n);
    int st = 0, dr = n - 1;
    for(i = 0, j = n - 1, k = 0; j - i + 1 >= 4; i += 2, j -= 2)
    {
        sol[st++] = i;
        sol[st++] = n - i - 1;
        sol[dr--] = i + 1;
        sol[dr--] = n - i - 2;
    }
    if(j - i + 1 == 1)
        sol[st++] = i;
    else
    if(j - i + 1 == 2)
    {
        sol[st++] = j;
        sol[st++] = i;
    }
    else
    if(j - i + 1 == 3)
    {
        sol[st++] = i;
        sol[st++] = i + 1;
        sol[st++] = j;
    }
    return sol;
}