#include "partition.h"
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
    vector<int> res;
std::vector<int> solve(std::vector<int> A)
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    res.clear();
    int s = A.size();
    if (s % 4 == 0)
    {
        for (int i = 1; i <= s/2; i+=2)
        {
            res.push_back(i-1);
            res.push_back(s-i+1-1);
        }
        for (int i = 2; i <= s/2; i+=2)
        {
            res.push_back(i-1);
            res.push_back(s-i+1-1);
        }
    }
    else if (s % 4 == 2)
    {
        for (int i = 1; i <= s/2-1; i+=2)
        {
            res.push_back(i-1);
            res.push_back(s-i+1-1);
        }
        res.push_back(s/2+1-1);
        for (int i = 2; i <= s/2-1; i+=2)
        {
            res.push_back(i-1);
            res.push_back(s-i+1-1);
        }
        res.push_back(s/2-1);
    }
    else if (s % 4 == 1)
    {
        s--;
        for (int i = 1; i <= s/2; i+=2)
        {
            res.push_back(i-1);
            res.push_back(s-i+1-1);
        }
        res.push_back(s+1-1);
        for (int i = 2; i <= s/2; i+=2)
        {
            res.push_back(i-1);
            res.push_back(s-i+1-1);
        }
    }
    else if (s % 4 == 3)
    {
        s--;
        for (int i = 1; i <= s/2-1; i+=2)
        {
            res.push_back(i-1);
            res.push_back(s-i+1-1);
        }
        res.push_back(s/2+1-1);
        res.push_back(s+1-1);
        for (int i = 2; i <= s/2-1; i+=2)
        {
            res.push_back(i-1);
            res.push_back(s-i+1-1);
        }
        res.push_back(s/2-1);
    }
    return {res};
}
