#include "partition.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
std::vector<int> solve(std::vector<int> A) {
    ll n=A.size();
    ll s=0;
    for(int i=0;i<n;i++)
    {
        s+=A[i];
    }
    ll x=(s+1)/2,cur=n+1;
    vector<int>b,w;
    for(int i=0;i<(1<<n);i++)
    {
        ll c=0,r=0;
        for(int j=0;j<n;j++)
        {
            if(i&(1<<j))
            {
                if(c>=x)
                    break;
                c+=A[j];
                r++;
            }
        }
        if(c>=x)
        {
            if(abs(r-(n-r))<cur)
            {
                for(int j=0;j<n;j++)
                {
                    if(i&(1<<j))
                    {
                        b.push_back(j);
                    }
                    else
                        w.push_back(j);
                }
                cur=abs(r-(n-r));
            }
        }
    }
    for(int i:w)
        b.push_back(i);
    return b;
}
