#include "partition.h"
#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
using namespace std;
std::vector<int> solve(std::vector<int> A)
{
    vector<pair<int,int>>order;

    int n=A.size();
    long long sum=0;
    for(int i=0;i<A.size();i++)
    {
        sum+=A[i];
        order.push_back({A[i],i});
    }
    sort(order.begin(),order.end());

    int best=n;
    vector<int>curans,other,ans;
    for(int mask=1;mask<(1<<n);mask++)
    {
        int f=-1;
        long long cursum=0,sz=0;
        bool ok=0;
        curans.clear();
        for(int i=0;i<n;i++)
        {
            if(((1<<i)&(mask))==0){other.push_back(i);continue;}
            curans.push_back(order[i].second);
            cursum+=order[i].first;

            if(cursum*2>=sum)
            {
                if(f==-1)f=i;
                else ok=0;
            }
        }

        if(f!=-1 && ok)
        {
            if(max(2*n-sz,2*sz-n)<best)
            {
                best=max(2*n-sz,2*sz-n);
                for(int x:other)curans.push_back(x);
                ans=curans;
            }
        }
    }

    return ans;
}
