#include <bits/stdc++.h>
#include "partition.h"
#define endl '\n'

using namespace std;

const int MAXN = 2 * 1e6;

int n;
vector<int>otg;
double a[MAXN + 5], s;


std::vector<int> solve(std::vector<int> A)
{
    n = A.size();
    s = 0;
    otg.clear();

    for(int i = 0; i < A.size(); i++)
    {
        a[i] = A[i];
        s += A[i];
    }

    vector<int>v;
    for(int i = 0; i < n; i++)
    {
        v.push_back(i);
    }

    int ans = 1e9;

    do
    {
        double sum = 0;
        for(int i = 0; i < v.size(); i++)
        {
            sum += a[v[i]];
            if(sum >= s / 2)
            {
                int curr = abs((n - (i + 1)) - (i + 1));
                if(ans > curr)
                {
                    otg = v;
                    ans = curr;
                }
                break;
            }
        }



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


    return otg;
}
