#include<bits/stdc++.h>
#include "partition.h"
#define endl "\n"
using namespace std;
void speed()
{
    ios_base :: sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
}

bool cmp(pair<int, int> x, pair<int, int> y)
{
    return x.first < y.first;
}
vector<int> solve(vector<int> A)
{
    int n = A.size();
    vector<pair<int, int> > a(n);
    for(int i = 0; i < n; i++)
    {
        a[i].first = A[i];
        a[i].second = i;
    }
    sort(a.begin(), a.end(), cmp);
    vector<int> ans(n, -1);
    int cur = 0;
    for(int i = 0; i < n; i += 2)
    {
        ans[cur++] = a[i].second;
    }
    for(int i = 1; i < n; i += 2)
    {
        ans[cur++] = a[i].second;
    }
    return ans;
}

