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

#define ll long long

vector<int>solve(vector<int>A)
{
      int n=(int)A.size();
      ll sum=0;
      for(int i=0;i<n;i++) sum+=A[i];
      vector<int>p;
      ll mn=n+1;
      for(int i=0;i<n;i++) p.push_back(i);
      do{
            ll cur=0,cnt=0;
            for(int i=0;i<n;i++){
                  cur+=A[p[i]];
                  cnt++;
                  if(cur>=(sum/2)+(sum&1)) break;
            }
            ll c2=n-cnt;
            mn=min(mn,abs(c2-cnt));

      }while(next_permutation(p.begin(),p.end()));
      p.clear();
      for(int i=0;i<n;i++) p.push_back(i);
      do{
            ll cur=0,cnt=0;
            for(int i=0;i<n;i++){
                  cur+=A[p[i]];
                  cnt++;
                  if(cur>=(sum/2)+(sum&1)) break;
            }
            ll c2=n-cnt;
            if(abs(c2-cnt)==mn){
                  return p;
            }

      }while(next_permutation(p.begin(),p.end()));
      return {0};
}
