#include <bits/stdc++.h>
#define fi first
#define se second
#include "partition.h"
#pragma GCC optimize ("O2")

using namespace std;

int S = 0,n;

bool Comp(pair <int,int> a,pair <int,int> b){
    return a.fi>b.fi;
}

std::vector<int> solve(std::vector<int> A){
    bool issubtask2 = 1;
    bool issubtask4 = 1;
    vector <int> ans;
    vector <pair <int,int>> B;
    n = A.size();
    S = 0;
    for (int i=0;i<n;++i){
        S += A[i];
        B.push_back({A[i],i});
    }
    sort(B.begin(),B.end(),Comp);
    int s = 0;
    int sz = 0;
    while (s<S/2){
        s += B[sz].fi;
        sz++;
    }
    int Dn = n/2; // how much Deni will have from the prefix
    if (n%2==0) Dn--;
    Dn = min(Dn,sz);
    for (int i=0;i<Dn;++i) ans.push_back(B[i].se);
    ans.push_back(B[n-1].se);
    for (int i=Dn;i<n-1;++i) ans.push_back(B[i].se);
    return ans;
}