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

unordered_map<int,int> cnt1,cnt2;
vector<int> ans;

vector<int> solve(vector<int> a){
    int n=a.size(),ind1=0,ind2=(n+1)/2;
    ans.assign(n,0);
    for(int i=0;i<n;i++){
        if(cnt1[a[i]]>cnt2[a[i]]){
            ans[ind2]=i;
            ind2++;
            cnt2[a[i]]++;
        }else{
            ans[ind1]=i;
            ind1++;
            cnt1[a[i]]++;
        }
    }
    return ans;
}

/*

1
12
5 5 6 3 5 6 5 1 3 1 4 4

*/
