#include "partition.h"
#include <bits/stdc++.h>
std::vector<int> solve(std::vector<int> A) {
    int n = A.size();
    std::vector<std::pair<long long, int>> v(n);
    for (int i = 0; i < n; ++i) {
        v[i] = {A[i], i};
    }
    sort(v.begin(), v.end(), std::greater<std::pair<long long, int>>());
    long long a, b;
    std::vector<int> ans_a, ans_b;
    for (auto& [x, i] : v) {
        if (a < b) {
            a += x;
            ans_a.push_back(i);
        } else {
            b += x;
            ans_b.push_back(i);
        }
    }
    std::vector<int> ans = ans_a;
    for (auto& x : ans_b) {
        ans.push_back(x);
    }
    return ans;
}
