#include "partition.h"
#include <algorithm>
#include <vector>
#include <utility>

using namespace std;

std::vector<int> solve(std::vector<int> A) {

    int N = (int)A.size();

    vector<pair<int,int>> V;
    

    for(int i=0;i<N;++i) {
        V.push_back({A[i],i});
    }

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

    vector<int> res;

    for(int i=0;i<N;i+=2) {
        res.push_back(V[i].second);
    }
    for(int i=1;i<N;i+=2) {
        res.push_back(V[i].second);
    }

    return res;
}
