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

#define ll long long
vector<ll>a;
int N;

ll get(vector<int>res){
      ll sum=0;
      for(ll x:res) sum+=a[x];
      ll cur=0,cnt=0;
      for(ll i=0;i<N;i++){
            cur+=a[res[i]];
            cnt++;
            if(cur>=sum/2ll+(sum&1ll)) break;
      }
      ll c1=cnt;
      ll c2=N-cnt;
      return abs(c1-c2);
}

vector<int>solve(vector<int>A)
{
      int n=A.size();
      N=n;
      a.resize(n);
      for(int i=0;i<n;i++) a[i]=A[i];
      vector<pair<ll,vector<int>>>all;
      for(int bit=0;bit<(1<<n);bit++){
            vector<int>v1,v2;
            for(int i=0;i<n;i++){
                  if((1<<i)&bit) v1.push_back(i);
                  else v2.push_back(i);
            }
            vector<int>res;
            for(int x:v1) res.push_back(x);
            for(int x:v2) res.push_back(x);
            all.push_back({get(res),res});
      }
      sort(all.begin(),all.end());
      return all[0].second;
}
