#include "partition.h"
#include <bits/stdc++.h>
using namespace std;
std::vector<int> solve(std::vector<int> A) {
    map<int, vector<int>> K;
    vector<int> ans;

    for (int i = 0; i < A.size(); i++) {
        K[A[i]].push_back(i);
    }

    sort(A.rbegin(), A.rend());

    for (int i = 0; i < A.size(); i++) {
        ans.push_back(K[A[i]][0]);
        K[A[i]].erase(K[A[i]].begin());
    }

    return ans;
}
