#include <bits/stdc++.h>

using namespace std;

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