#include "partition.h"
#include <bits/stdc++.h>

using namespace std;;
long long s,h;
int c[30];
long long n,a[100001];
vector<int> v[30];
std::vector<int> solve(std::vector<int> A)
{
    s=h=0;
    n=A.size();

    vector<int> hey;
    vector<pair<int,int> > hey2;
    for(int i=0;i<A.size();i++)
    {
        hey2.push_back({A[i],i});
    }

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

    for(int i=0;i<hey2.size();i+=2)
    {
        hey.push_back(hey2[i].second);
    }

    for(int i=1;i<hey2.size();i+=2)
    {
        hey.push_back(hey2[i].second);
    }

    return hey;

    /*for(int i=0;i<=25;i++)
        c[i]=0, v[i].clear();
    for(int i=0;i<n;i++)
    {
        int p=0;
        while((1<<p)!=A[i])p++;
        c[p]++;
    }

    vector<pair<int,int> > h;
    for(int i=0;i<n;i++)
    {
        int p=0;
        while((1<<p)!=A[i])p++;
        if(c[p]%2==0)
        {
            h.push_back({p,i});
            c[p]--;
        }
        else
        {
            v[p].push_back(i);
        }
    }

    vector<int> g;
    for(int i=0;i<=30;i++)
    {
        for(int j=0;j<v[i].size()/2;j++)
        {
            g.push_back(v[i][j]);
        }
    }



    for(long long i=0;i<n;i++)
        a[i]=A[i];

    for(long long i=0;i<n;i++)
        h+=a[i];
    s=h;
    h=h/2+h%2;
    //cout<<s<<" "<<h<<endl;

    long long ans=n+1,f=0;
    for(long long i=0;i<(1<<n);i++)
    {
        long long cnt=0,in=0,maxx=0;
        for(long long j=0;j<n;j++)
        {
            if(i&(1<<j))
            {
                maxx=max(maxx,a[j]);
                cnt++;
                in+=a[j];
            }
        }

        if(in>=h&&in-maxx<h)
        {
            ans=min(ans,abs(n-2*cnt));
            if(ans==abs(n-2*cnt))f=i;
        }
    }

    vector<int> v;

    int maxx=0,id=0;
    for(long long i=0;i<n;i++)
    {
        if((1<<i)&f)
        {
            if(a[i]>maxx)
            {
                maxx=a[i];
                id=i;
            }
        }
    }

    for(long long i=0;i<n;i++)
    {
        if(((1<<i)&f)&&i!=id)
        {
            v.push_back(i);
        }
    }

    v.push_back(id);


    for(long long i=0;i<n;i++)
    {
        if((1<<i)&f);
        else v.push_back(i);
    }

    return v;*/
}
