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

using namespace std;


vector<int> solve(vector<int> A){
    int N, i, sum_l, sum_r;
    vector <int> lft, rgt, rez;

    sum_l = sum_r = 0;
    N = A.size();
    for(i = N - 1; i >= 0; i--){
        if(sum_l <= sum_r){
            lft.push_back(i);
            sum_l += A[i];
        }else{
            rgt.push_back(i);
            sum_r += A[i];
        }
    }
    for(i = 0; i < lft.size(); i++){
        rez.push_back(lft[i]);
    }
    for(i = 0; i < rgt.size(); i++){
        rez.push_back(rgt[i]);
    }
    return rez;
}
//5
//4
//1 2 4 8
//5
//1 2 4 8 16
