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

#define pb push_back
#define sz(x) (ll)x.size()
#define pw(x) ((1LL)<<(x))
#define all(x) x.begin(), x.end()

using ll = int;
using ld = long double;

using namespace std;

vector<int> solve(vector<int> A){
    vector<ll> a = A;
    ll n = sz(a);
    ll i, j;
    vector<pair<ll,ll>> p;
    for (i=0;i<n;i++){
        p.pb({a[i],i});
    }
    vector<ll> left, right;
    for (i=0;i<n/2;i++){
        if (i%2==0){
            left.pb(p[i].second);
            left.pb(p[n-i-1].second);
        }else{
            right.pb(p[i].second);
            right.pb(p[n-i-1].second);
        }
    }
    if (n&1){
        left.pb(p[n/2].second);
    }
    vector<ll> ans;
    for (auto x : left) ans.pb(x);
    for (auto x : right) ans.pb(x);
    return ans;
}