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

typedef long long LL;

vector<int> solve(vector<int> A) {
    vector<int> v;
    LL s = 0;
    for(int ch : A) s += (LL)ch;
    s = s / 2 + s % 2;
    for(int i = 0; i < A.size(); i++) {
        v.push_back(i);
    }
    vector<int> ert;
    int minr = INT_MAX;
    do{
        LL s1 = 0;
        int i;
        for( i = 0; i < v.size(); i++) {
            s1 += A[v[i]];
            if(s1 >= s) break;
        }
        if(minr > abs((int)A.size() - 2 * (i + 1))) {
            minr = abs((int)A.size() - 2 * (i + 1));
            ert = v;
        }
    }while(next_permutation(v.begin(), v.end()));
    return ert;
}
