#include "partition.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> solve(vector<int> A) {
    vector<pair<long long, int>> v;
    for (int i = 0; i < (int)A.size(); i ++){
        v.push_back({A[i], i});
    }
    sort(v.begin(), v.end(), greater<pair<long long, int>>());
    long long cnt1 = 0, cnt2 = 0;
    vector<int> a, b;
    for (pair<long long, int> i : v){
        if (cnt1 <= cnt2){
            cnt1 += i.first;
            a.push_back(i.second);
        }
        else {
            cnt2 += i.first;
            b.push_back(i.second);
        }
    }
    for (int i : b)a.push_back(i);
    return {a};
}
