#include <bits/stdc++.h>
using namespace std;

vector<int> solve(vector<int>A)
{
    sort(A.begin(), A.end());
    float s=0.0;
    int packs=A.size();
    for(int i=0; i<packs; i++) s+=A[i];

    int sum1=0, sum2=0;
    int diff=0, minDiff=INT_MAX;
    vector<int>a2=A;

    do 
    {
        int currentSum=0;
        for(int i=0; i<packs; i++)
        {
            currentSum+=A[i];
            sum1++;
            if(currentSum>=(s/2.0)) break;
        }
        sum2=s-sum1;
        diff=abs(sum1-sum2);

        if(minDiff<diff)
        {
            a2=A;
        }
        minDiff=min(minDiff, diff);

    } while(next_permutation(A.begin(), A.end()));

    vector<int>indexes;
    for(int i=0; i<packs; i++)
    {
        for(int j=0; j<packs; j++)
        {
            if(A[i]==a2[j])
            {
                indexes.push_back(j);
                a2[j]=INT_MAX;
                break;
            }
        }
    }
    return indexes;
}
