#include "partition.h"
#include <bits/stdc++.h>
#define ll long long
using namespace std;

const int N=2e6+5;
int n;
ll all=0;
vector<pair<int, int>> v;
vector<int> ans;

void add(int l, int r, vector<pair<int, int>> &a) {
    for(int i=l; i<=r; i++)
        ans.push_back(a[i].second);
}
void clr() {
    ans.clear();
    v.clear();
    all=0;
}

std::vector<int> solve(std::vector<int> A) {
    clr();
    n=A.size();
    for(int i=0; i<n; i++)
        v.push_back({A[i], i});
    sort(v.begin(), v.end());
    for(int i=0; i<n; i++)
        all+=A[i];
    int mn=2*n;
    do
    {
        ll curr=0;
        for(int i=0; i<n; i++) {
            curr+=v[i].first;
            if(curr>=(all+1)/2) {
                if(mn>abs(2*i+2-n)) {
                    mn=abs(2*i+2-n);
                    vector<int> c;
                    for(int q=0; q<n; q++)
                        c.push_back(v[q].second);
                    ans=c;
                }
                break;
            }
        }
    }
    while(next_permutation(v.begin(), v.end()));
    return ans;
}
