#include "partition.h"
#define _GLIBCXX_FILESYSTEM
#include<bits/stdc++.h>
using namespace std;
vector<int> solve(vector<int> a) {
    vector<pair<int, int>> aiidx;
    long long s = 0;
    for (int i = 0; i < a.size(); i++) {
        aiidx.push_back({a[i], i});
        s+=a[i];
    }
    sort(aiidx.begin(), aiidx.end());
    vector<int> d;
    int mnr = a.size();
    do{
        long long t = 0;
        for (int i = 0; i < aiidx.size(); i++) {
            t+=aiidx[i].first;
            if (t >= (s+1)/2) {
                if (abs(a.size()-(2*i+2)) < mnr) {
                    mnr = abs(a.size()-(2*i+2));
                    d = aiidx;
                }
                break;
            }
        }
    } while(next_permutation(aiidx.begin(), aiidx.end()));
    return d;
}
