#include "partition.h"
#include <algorithm>
#include <cmath>
#include <vector>

using namespace std;
const int N = 2e6 + 67;
typedef long long ll;

#define all(X) (X).begin(), (X).end()
#define ff first
#define ss second

bool used[N];
pair<int, int>a[N];

std::vector<int> solve(std::vector<int> A) 
{
	int n = A.size();
	ll S = 0;
	for (int i = 0; i < n; i++) {
		a[i + 1] = { A[i], i };
		S += 1ll * A[i];
	}
	vector<int>answ;
	int mn = 1e9;
	vector<int>vec;
	for (int i = 0; i < n; i++)
		vec.push_back(i);
	do
	{
		if (mn == 0)break;
		int d = 0;
		int r = 0;
		long long sm = 0;
		while (2 * sm < S)
		{
			sm += A[vec[r]];
			r++;
		}
		r--;
		int cur = abs(n - 2 * (r + 1));
		if (mn > cur)
		{
			answ = vec;
			mn = cur;
		}
	} while (next_permutation(all(vec)));

	return answ;
}
