#include <bits/stdc++.h>

using namespace std;

std::vector<int> solve(std::vector<int> A)
{
    vector<pair<int,int>> vec;
    for(int i=0;i<A.size();i++)
    {
        vec.push_back({A[i],i});
    }
    sort(vec.begin(),vec.end());
    int br=0;
    vector<int> vec1,vec2;
    for(int i=A.size()-1;i>=0;i--)
    {
        if(br<=0)
        {
            br+=vec[i].first;
            vec1.push_back(vec[i].second);
        }
        else
        {
            br-=vec[i].first;
            vec2.push_back(vec[i].second);
        }
    }
    if(br>=0)
    {
        for(auto it : vec2)
            vec1.push_back(it);
        return vec1;
    }
    else
    {
        for(auto it : vec1)
            vec2.push_back(it);
        return vec2;
    }
}

