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

#define pb push_back
#define sz(x) (x).size()
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define fi first
#define se second

using ll = long long;

vector<int> solve(vector<int> A) {
    int n = sz(A);
    pair<int, int> a[n];
    int s = 0;
    for (int i = 0; i < n; i++) {
        a[i].fi = A[i];
        a[i].se = i;
        s += a[i].fi;
    }
    sort(a, a + n);
    vector<int> _ans(n);
    int ans = n + 1;
    do {
        int curs = 0;
        int k = 0;
        for (int i = 0; i < n; i++) {
            curs += a[i].fi;
            if (curs * 2 >= s) {
                k = i + 1;
                break;
            }
        }
        curs = abs(2 * k - n);
        if (curs < ans) {
            for (int i = 0; i < n; i++) {
                _ans[i] = a[i].se;
            }
            ans = curs;
//            cout << ans << endl;
        }
    } while (next_permutation(a, a + n));
    return _ans;
}