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

std::vector<int> solve(std::vector<int> a) {
    int n = a.size();
    vector<int> ans;

    ll tot = 0;
    for (int x : a) tot += x;

    int cur = n;

    vector<int> ord;
    for (int i=0; i<n; i++)
        ord.push_back(i);

    do {
        int cnt = 0;
        ll sum = 0;

        for (int u : ord) {
            sum += a[u];
            cnt++;
            if (sum >= tot / 2) break;
        }

        if (abs(cnt - (n - cnt)) < cur) {
            cur = abs(cnt - (n - cnt));
            ans = ord;
        }
    } while (next_permutation(ord.begin(), ord.end()));

    return ans;
}
