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

//unordered_map<int,int> cnt1,cnt2;
vector<int> ans;
vector<pair<int,int>> b;

vector<int> solve(vector<int> a){
    int n=a.size(),ind1=0,ind2=n-1,sum1=0,sum2=0;
    ans.clear();
    b.clear();
    ans.assign(n,0);
    for(int i=0;i<n;i++){
        b.push_back({a[i],i});
    }
    sort(b.begin(),b.end());
    for(int i=0;i<n;i++){
        if(sum1<sum2){
            sum1+=b[i].first;
            ans[ind1]=b[i].second;
            ind1++;
        }else{
            sum2+=b[i].first;
            ans[ind2]=b[i].second;
            ind2--;
        }
    }

    return ans;
}

/*

1
12
5 5 6 3 5 6 5 1 3 1 4 4

*/
