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

vector<int> solve(vector<int> a) {
    int n = a.size();
    vector<int> o(n);
    iota(o.begin(), o.end(), 0);
    sort(o.begin(), o.end(), [&](int i, int j) {
        return a[i] > a[j];
    });
    int co = 0;
    for (int i = (n - 1) / 2 * 2; i >= 0; i -= 2) {
        a[co++] = o[i];
    }
    for (int i = 1; i < n; i += 2) {
        a[co++] = o[i];
    }
    return a;
}