#include "partition.h"
#include <iostream>
using namespace std;
#include <map>
#include <queue>
#include <cassert>

const int N = 2e6 + 10;

std::vector<int> solve(std::vector<int> A) {
	int n = A.size();
	long long sum = 0;
	vector<int> res;
	for (int i = 0; i < n; i++) {
		sum += A[i];
		res.push_back(i);
	}
	sum = (sum + 1) / 2;
	int s = 0;
	for (int i = 0; i < (n + 1) / 2; i++) {
		s += A[i];
	}
	int l = (n + 1) / 2 - 1, r = n - 1;
	while (l >= 0 && s < sum) {
		s -= A[l];
		s += A[r];
		swap(res[l], res[r]);
		l--, r--;
	}
	return res;
}
