#include<iostream>
#include"partition.h"
#include<vector>
using namespace std;
vector<int> solve(vector<int> A)
{
    int ans1 = 1e9;
    int bits = 0;
    int total = 0;
    for(int i = 0; i < A.size(); i++) total+=A[i];
    for(int i = 0; i < (1<<A.size()); i++)
    {
        int temp = i;
        int curbit = 0;
        int cursum = 0;
        while(temp)
        {
            int bit = temp & 1;
            if(bit) cursum+=A[curbit];
            curbit++;
            temp = temp>>1;
        }
        if(abs(total - cursum - cursum) < ans1 && (total - cursum - cursum < 0 || (total - cursum - cursum == 0 && A.size()%2 == 0)))
        {
            ans1 = abs(total - cursum - cursum);
            bits = i;
        }
    }
    int bits2 = bits;
    vector<int> ans;
    for(int i = 0; i < A.size(); i++)
    {
        int bit = bits & 1;
        if(bit) ans.push_back(i);
        bits = bits>>1;
    }
    for(int i = 0; i < A.size(); i++)
    {
        int bit = bits2 & 1;
        if(!bit) ans.push_back(i);
        bits2 = bits2>>1;
    }
    return ans;
}
