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

#define pb push_back
#define sz(x) (x).size()
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define fi first
#define se second

using ll = long long;

vector<int> solve(vector<int> a) {
    int n = sz(a);
    pair<int, int> _a[n];
    for (int i = 0; i < n; i++) {
        _a[i] = {a[i], i};
    }
    sort(_a, _a + n);
    vector<int> ans(n);
    for (int i = 0; i < n; i++) {
        if (i & 1) {
            ans[n - (i >> 1) - 1] = _a[i].se;
        } else {
            ans[i >> 1] = _a[i].se;
        }
    }
    return ans;
}