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

long long s_total=0;

vector<int> solve(vector<int> a)
{
    int n=a.size();
    s_total=0;
    vector<int> p;
    for(int i=0; i<n; i++)
    {
        p.push_back(i);
        s_total+=a[i];
    }
    s_total=(s_total+1)/2;
    vector<int> ans;
    int dif_min=n;
    do
    {
        long long sum=0;
        int dif=0;
        for(int i=0; i<n; i++)
        {
            sum+=a[p[i]];
            dif++;
            if(sum>=s_total) break;
        }
        dif=abs(n-2*dif);
        if(dif<dif_min)
        {
            dif_min=dif;
            ans=p;
        }
    }
    while(next_permutation(p.begin(), p.end()));
    return ans;
}