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

using namespace std;

#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define pb push_back
#define endl '/n'


vector<int> solve(vector<int> a) {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n = a.size();

    vector <int> x, y;
    long long sumx = 0, sumy = 0;

    vector <pair<int,int> > b(n);

    for(int i = 0;i < n;i++){
        b[i].ff = a[i];
        b[i].ss = i;
    }

    sort(all(b));

    for(int i = 0;i < n;i++){
        if(sumx <= sumy){
            sumx += b[i].ff;
            x.pb(b[i].ss);
        }
        else{
            sumy += b[i].ff;
            y.pb(b[i].ss);
        }
    }

    vector <int> ans;

    if(sumx >= sumy){
        for(int i = 0;i < (int)x.size();i++){
            ans.pb(x[i]);
        }
        for(int i = 0;i < (int)y.size();i++){
            ans.pb(y[i]);
        }
    }
    else{
        for(int i = 0;i < (int)y.size();i++){
            ans.pb(y[i]);
        }
        for(int i = 0;i < (int)x.size();i++){
            ans.pb(x[i]);
        }
    }
    //cout<<sumx << ' ' << sumy << endl;
    return ans;
}
