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

vector <int> solve(vector <int> a) {
    bool used[100001]{};
    vector <int> b(a.size(), 0);
    int l=0, r=a.size()-1;
    for (int i=0;i<a.size();i+=1) {
        if (!used[a[i]]) {
            b[l]=i;
            l+=1;
            used[a[i]]=1;
        }
        else {
            b[r]=i;
            r-=1;
            used[a[i]]=0;
        }
    }
    return b;
}