# include "partition.h"
# include <bits/stdc++.h>
# define ll long long
using namespace std;

int n;

vector<int> solve(vector<int> a)
{
    n = (int)a.size();
    ll s = 0;
    vector<pair<int, int>> b;

    for(int i = 0; i < n; i++)
    {
        b.push_back({a[i], i});
        s += a[i];
    }

    sort(b.begin(), b.end());

    vector<int> answer;
    vector<bool> visited(n + 1, false);
    int index = 0;
    ll current = 0;

    while(index < n)
    {
        current += b[index].first;
        answer.push_back(b[index].second);
        visited[b[index].second] = true;
        if(current >= (s / 2)) break;
        index += 2;
    }

    for(int i = 0; i < n; i++)
    {
        if(!visited[i]) answer.push_back(i);
    }

    return answer;
}
