#include "partition.h"
#include <vector>
#include <utility>
#include <iostream>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <iomanip>
#include <random>
#include <chrono>
#include <algorithm>
#include <cmath>
#include <math.h>
#include <string>
#include <cstring>

using namespace std;

#define ll long long
#define pb push_back
#define fr first
#define sc second

const int N = 200005, N1 = 20;
const ll oo = 10000000000000000, MOD = 1000000007;

ll a[N];
pair<ll, int> p[N];

std::vector<int> solve(std::vector<int> A) {
	int n = A.size();
	//map<int, vector<int>> ind1;
	vector<int> dis;
	vector<int> pat;
	//pat.pb(n-1);
	ll target = 0;
	for (int i = 1; i <= n; ++i) {
		a[i] = A[i - 1];
		p[i].fr = a[i];
		p[i].sc = i - 1;
		target += a[i];
	}
	target /= 2;
	ll sum = 0;
	sort(p + 1, p + n + 1);
	int x1 = 0, x2 = n;
	ll mn = oo;
	for (int i = 1; i <= n; ++i) {
		sum += p[i].fr;
		if (sum >= target) {
			if (abs((n - i) - i) < mn) {
				mn = abs(n - i) - i;
				x1 = i;
				x2 = i+1;
			}
		}
		ll sum1 = 0;
		for (int j = n; j >= 1; --j) {
			sum1 += p[j].fr;
			if (sum1 + sum >= target) {
				int qan = i + (n - j + 1);
				if (abs((n - qan) - qan) < mn) {
					x1 = i;
					x2 = j;
				}
			}
		}
	}
	for (int i = 1; i <= x1; ++i) {
		pat.pb(p[i].sc);
	}
	for (int i = n; i >= x2; --i) {
		pat.pb(p[i].sc);
	}
	for (int i = x1 + 1; i < x2; ++i) {
		pat.pb(p[i].sc);
	}
	return pat;
	/*vector<int> skizb, verj;
	for (int num : dis) {
		int sz = ind1[num].size();
		for (int i = 0; i < ind1[num].size(); ++i) {
			if (i < sz / 2) {
				skizb.pb(ind1[num][i]);
			}
			else {
				verj.pb(ind1[num][i]);
			}
		}
	}
	for (int num : skizb) {
		pat.pb(num - 1);
	}
	for (int num : verj) {
		pat.pb(num - 1);
	}
	return pat;*/
}
