#include "partition.h"
std::vector<int> solve(std::vector<int> A){
    std::vector<int>sol;
    std::vector<int>afis;
    sol.push_back(0);
    long long lng=A.size();
    long long sfin=lng*(lng+1)/4;
    long long half=(lng+1)/2;
    long long sacm=half*(half+1)/2;
    long long idx1=half,idx2=lng;
    for(int i=1;i<=half;i++)sol.push_back(i);
    while(sacm<sfin){
        sacm+=idx2-sol[idx1];
        sol[idx1]=idx2;
        idx2--;
        idx1--;
    }
    for(int i=1;i<=half;i++)afis.push_back(sol[i]-1);
    for(int i=idx1+1;i<=idx2;i++)afis.push_back(i-1);
    return afis;
}