#include "partition.h"
#include<bits/stdc++.h>
std::vector<int> solve(std::vector<int> A)
{
    long long N = A.size();
    std::vector<std::pair<int, int> > arr;
    for(int i = 0; i < N; i++)
    {
        arr.push_back(std::make_pair(A[i], i));
    }
    sort(arr.begin(), arr.end());
    std::vector<int> ans;
    ans.resize(N);
    for(int i = 0; i <= N / 2; i += 2)
    {
        std::swap(arr[i], arr[N - i - 1]);
    }
    std::swap(arr[0], arr[N / 2]);
    for(int i = 0; i < N; i++)
    {
        ans[i] = arr[i].second;
    }
    return ans;
}

