#include "partition.h"
using namespace std;
std::vector<int> solve(std::vector<int> A) {
    vector<bool> V(2*10000000, 0);
    int siz=A.size();
    vector<int> R(siz);
    int i=0, j=siz-1;

    for (int k=0; k<siz; k++) {
        if (V[A[k]]==1) {
            R[i]=k;
            i++;
            V[A[k]]=0;
        }
        else {
            R[j]=k;
            j--;
            V[A[k]]=1;
        }
    }

    return {R};
}
