#include<bits/stdc++.h>
#include "partition.h"
#define endl '\n'
using namespace std;
void speed()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
struct cell
{
    int ind,st;
};
bool cmp(cell a1,cell a2)
{
    return a1.st<a2.st;
}
int t,n;
cell a[2000005];
vector<int>otg1,otg2;
vector<int> solve(vector<int> A)
{
    otg1.clear();
    otg2.clear();
    n=A.size();
    long long int sum=0;
    for(int i=1; i<=n; i++)
    {
        a[i].st=A[i-1];
        a[i].ind=i;
        sum+=a[i].st;
    }
    sort(a+1,a+n+1,cmp);
    long long int st1=0,st2=0;
    for(int i=n; i>=0; i--)
    {
        if(st1<=st2)
        {
            st1+=a[i].st;
            otg1.push_back(a[i].ind-1);
        }
        else
        {
            st2+=a[i].st;
            otg2.push_back(a[i].ind-1);
        }
        //cout<<st1<<" "<<st2<<endl;
    }
    for(int i=0;i<otg2.size();i++)
    {
        otg1.push_back(otg2[i]);
    }
    return otg1;
}
