#include <iostream>

#include<vector>

#include<map>

#include<algorithm>

#include "partition.h"

using namespace std;

vector<int> solve(vector<int> A) {
	vector<int> sol(A.size());
	map<int, int> fr;
	bool par = true;
	for (auto x : A) {
		fr[x]++;
	}
	for (auto x : A) {
		if (fr[x] % 2 == 1) par = false;
	}
	if (par == true) {
		int s = 0;
		int f = 0;
		map<int, int> aux;
		for (int i = 0; i < A.size(); ++i) {
			aux[A[i]]++;
			if (aux[A[i]] <= fr[A[i]] / 2) {
				sol[++s] = i;
			}
			else {
				sol[A.size() / 2 + f] = i;
				++f;
			}
		}
		return sol;
	}
	
}
