#include "partition.h"
#include<bits/stdc++.h>
using namespace std;
using ll = long long;

const ll INF = 1e18;

vector<int> solve(vector<int> A)
{
    int n = A.size();
    vector<pair<int,int>>arr(n);
    for(int i=0; i<n; i++)
        arr[i] = {A[i],i};

    sort(arr.begin(),arr.end());

    vector<int>left,right;
    for(int i=0; i<A.size(); i++)
    {
        if(i%2 == 0)
            left.push_back(arr[i].second);
        else
            right.push_back(arr[i].second);

    }


    int left_sz = left.size();
    vector<int>ans(n);
    for(int i=0; i<left_sz; i++)
        ans[i] = left[i];

    for(int i=0; i<right.size(); i++)
        ans[left_sz+i] = right[i];

    return ans;
}
