#include <bits/stdc++.h>
#include "partition.h"
using namespace std;
vector<int> solve(std::vector<int> A) {
    int sumM=0, sumD=0, i=0, j=1, N=(int)A.size();
    sort(A.begin(), A.end());
    vector<int> resM, resD;
    sumM=A[i];
    sumD=A[j];
    resM.push_back(0);
    resD.push_back(1);
    i=j;
    while(i<=N&&j<=N){
        if(sumM>sumD){
            j++;
            i=j;
            sumD+=A[j];
            resD.push_back(j);
        }
        else{
            i++;
            j=i;
            sumM+=A[i];
            resM.push_back(i);
        }
    }
    for(auto it:resM)
        resD.push_back(it);
    return resD;
}
