#include "partition.h"
#include <algorithm>
using namespace std;
vector<int> a;
bool cmp(int x,int y)
{
    return a[x]<a[y];
}
std::vector<int> solve(std::vector<int> A)
{
    a=A;
    vector<int> idx;
    for(int i=0;i<a.size();i++)
    {
        idx.push_back(i);
    }
    sort(idx.begin(),idx.end(),cmp);
    vector<int> ans1,ans2;
    for(int i=0;i<idx.size();i++)
    {
        if(i%2==0)
        {
            ans1.push_back(idx[i]);
        }
        else
        {
            ans2.push_back(idx[i]);
        }
    }
    for(int x:ans2)ans1.push_back(x);
    return ans1;
}
