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

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

    std::vector<std::pair<int, int> > tempveci(A.size());
    vector<int> veci(A.size());

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

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

    for (int i = 0; i<tempveci.size(); i+=2) {
        veci.push_back(tempveci[i].second);
    }
    for (int i = 1; i<tempveci.size(); i+=2) {
        veci.push_back(tempveci[i].second);
    }

    return veci;
}
