#include "partition.h"
#include<bits/stdc++.h>
using namespace std;
vector<int> solve(vector<int> v) {
	vector<int> ans;
	vector<int> v1;
	int sum = 0;
	int n = v.size();
	for(int i = 0; i < n; i++) {
		v1.push_back(i);
		sum+=v[i];
	}
	int mn = 1000000;
	do{
        int s = 0;
        int j = n;
        for(int i = 0; i < n; i++) {
        	j--;
        	s+=v[v1[i]];
        	if(s>=(sum+1)/2){
        		int k = abs(i+1-j);
        		if(k<mn) ans = v1;
        		break;
			}
		}
    }
    while (next_permutation(v1.begin(), v1.end()));
    
	return ans;
}
