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

std::vector<int> solve(std::vector<int> A) {
    int n = A.size();
    std::vector<std::pair<long long, int>> v(n);
    for (int i = 0; i < n; ++i) {
        v[i] = {A[i], i};
    }
    sort(v.begin(), v.end(), std::less<std::pair<long long, int>>());
    std::vector<std::vector<int>> vec(2);
    for (int i = 0; i < n; ++i) {
        int j = n - 1 - i;
        vec[i % 2].push_back(j);
    }
    std::vector<int> ans;
    for (int i = vec[0].size() - 1; i >= 0; --i) {
        ans.push_back(vec[0][i]);
    }
    for (int i = 0; i < vec[1].size(); ++i) {
        ans.push_back(vec[1][i]);
    }
    return ans;
}