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

vector<int> solve(vector<int> a)
{
    int n = a.size();
    vector<int>ind;
    vector<pair<int, int>>ord;
    long long sum=0;
    for(int i = 0;i < n; i++)
    {
        ind.push_back(0);
        ord.push_back({a[i], i});
        sum+=a[i];
    }
    long long sum2 = sum/2 + sum%2;
    sort(ord.begin(), ord.end());
    for(int i = 0; i<n;i++)
    {
        cout<<ord[i].first<<" "<<ord[i].second<<endl;
    }
    for(int i = 0; i<n;i++)
    {
        if(i%2==0)
        {
            ind[i/2]=ord[i].second;
        }
        else
        {
            ind[i/2+n/2]=ord[i].second;
            //cout<<"SET:"<<i/2+n/2<<"TO"<<ord[i].second<<"; i:"<<i<<endl;
        }
    }
    return ind;
}
