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

using namespace std;

std::vector<int> solve(std::vector<int> A) {
    int n = A.size();
    map<int,int>mp;
    for(int i=0;i<n;i++)
        if(!mp.count(A[i]))
            mp[A[i]]=i;
    vector<int>ans;
    for(auto pr:mp)
        ans.push_back(pr.second);
    for(int i=0;i<n;i++)
        if(mp[A[i]]!=i)
            ans.push_back(i);
    return ans;
}