#include "partition.h"
#include<iostream>
#include<vector>
#include<algorithm>
#define MAXN 2010
using namespace std;
vector<int> solve(vector<int> a)
{
    int n=a.size();
    long long total=0;
    for(int i=0;i<a.size();i++)
    {
        total+=a[i];
    }
    long long lim=(total>>1) + (total&1);//must be >=lim

    vector<int> order(n);
    vector<int> ans;
    int best=n;
    for(int i=0;i<n;i++)order[i]=i;

    do
    {
        int curr=n;
        long long sum=0;
        for(int i=0;i<n;i++)
        {
            sum+=a[order[i]];
            if(sum>=lim){curr=n-2*(i+1)+1;break;}
        }
        if(curr<best)
        {
            best=curr;
            ans=order;
        }
        if(best==0)break;
    }while(next_permutation(order.begin(),order.end()));

    return ans;
}