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

using namespace std;

vector<int> solve(vector<int> A)
{
    unordered_map<int,int> fr;
    vector<bool> pus(A.size(),0);
    vector<int> ans;
    int i,cnt;
    for(i=0;i<A.size();i++)
    {
        if(fr[A[i]]==0)
        {
            fr[A[i]]=1;
            ans.push_back(i);
            pus[i]=1;
        }
    }
    for(i=0;i<A.size();i++)
    {
        if(pus[i]==0)
            ans.push_back(i);
    }
    /*int s=0;
    cerr<<"VERIF: ";
    for(i=0;i<ans.size();i++)
    {
        s+=A[ans[i]];
        cerr<<s<<" ";
    }
    cerr<<endl;*/
    return ans;
}
/*
2
9
1 2 4 8 16 32 64 128 256
4
400 400 1 1
*/
