#include "partition.h"
#include <bits/stdc++.h>
using namespace std;
int bits[50],v[50];
vector<int>rez;
std::vector<int> solve(std::vector<int> A)
{
    int n=A.size(),sum=0,minn;
    minn=n;
    for(int i=0; i<n; i++)
        sum+=A[i];
    for(int i=0; i<(1<<n); i++)
    {
        int cnt=0,ci=i;
        for(int j=0; j<n; j++)
        {
            bits[j]=0;
            bits[j]=ci%2;
            v[j]=0;
            ci/=2;
        }
        for(int j=0; j<n; j++)
        {
            if(bits[j]==1)
            {
                v[cnt]=j;
                cnt++;
            }
        }
        sort(v,v+cnt);
        int s1=0,s2=0;
        for(int j=0; j<cnt-1; j++)
            s1+=A[v[j]];
        s2=s1+A[v[cnt-1]];
        if(2*s1<sum&&2*s2>=sum)
        {
            int l1=cnt,l2;
            l2=n-l1;
            if(minn>abs(l1-l2))
            {
                rez.clear();
                for(int j=0; j<cnt; j++)
                    rez.push_back(v[j]);
                for(int j=0; j<n; j++)
                {
                    if(bits[j]==0)
                        rez.push_back(j);
                }
                minn=abs(l1-l2);
            }
            if(minn==n%2)
                return rez;
        }
    }
    return rez;
}

