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

std::vector<int> solve(std::vector<int> A) {
	vector<int> ord(A.size());
	long long sum = 0;
	for (int i = 0; i < A.size(); i++) {
		ord[i] = i;
		sum += A[i];
	}
	vector<int> res;
	int mn = A.size() + 5;
	do {
		int c1 = 0, c2 = 0;
		long long s = 0;
		for (int i = 0; i < ord.size(); i++) {
			s += A[ord[i]];
			c1++;
			if (s >= (sum + 1) / 2) {
				break;
			}
		}
		c2 = A.size() - c1;
		if (abs(c1 - c2) < mn) {
			mn = abs(c1 - c2);
			res = ord;
		}
	} while (next_permutation(ord.begin(), ord.end()));
	return res;
}
