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

using namespace std;
bool cmp(pair<int,int> x,pair <int,int> y)
{
    if(x.second<y.second)return true;
    if(x.second>y.second)return false;
    return x.first<y.first;
}
vector <int> solve(vector<int> A)
{
    vector<pair<int,int>> v;
    for(int i=0; i<A.size(); i++)
    {
        v.push_back({i,A[i]});
        //cout<<"67"<<endl;
    }
    sort(v.begin(),v.end(),cmp);
    vector <int> ans;
    for(int i=0; i<v.size(); i+=2)
    {
        ans.push_back(v[i].first);
        //cout<<ans[i]<<endl;
    }
    for(int i=1; i<v.size(); i+=2)
    {
        ans.push_back(v[i].first);
        //cout<<ans[i]<<endl;
    }
    return {ans};
}
