#include "bits/stdc++.h"
#include "partition.h"
using namespace std;
#define ll long long
#define ff first
#define ss second
#define pb push_back
#define mod 1000000007
#define N 24
#define maxn 200005

ll sm=0,answer=1e9;
vector<pair<int,int> > v;
vector<int> ans,cur;

void f(int id,int sum){
	if(id==v.size())return;
	if(sum>=sm and abs((int)v.size()-(int)(cur.size())*2)<answer){
		ans.clear();
		answer=abs((int)v.size()-(int)(cur.size())*2);
		for(int i=0; i<cur.size(); i++)ans.pb(cur[i]);
		return;
	}
	f(id+1,sum);
	cur.pb(id);
	f(id+1,sum+v[id].ff);
	cur.pop_back();
}

std::vector<int> solve(std::vector<int> A) {
	answer=1e9;
	v.clear();
	sm=0;
	for(int i=0; i<A.size(); i++)v.pb({A[i],i}),sm+=A[i];
	sort(v.begin(),v.end());
	sm=sm/2+sm%2;
	f(0,0);
	map<int,bool> m;
	vector<int> aa;
	for(int i=0; i<ans.size(); i++)aa.pb(ans[i]);
	sort(ans.begin(),ans.end());
	int id=0;
	for(int i=0; i<A.size(); i++){
		if(id<ans.size() and i==ans[id]){
			id++;
			continue;
		}
		aa.pb(i);
	}
	ans.clear();
	return aa;
}