#include "partition.h"
#include <map>
#include <vector>
#include <algorithm>

std::vector<int> solve(std::vector<int> a) {
    int n = int(a.size());
    if(n % 2 == 1) {
        std::vector<int> sol;
        int t = 0;
        for(int i = 0; i + 1 < n; i += 2) {
            sol.push_back(i + t);
            t ^= 1;
        }
        sol.push_back(n - 1);
        t = 1;
        for(int i = 0; i + 1 < n; i += 2) {
            sol.push_back(i + t);
            t ^= 1;
        }
        return sol;
    } else {
        std::vector<int> sol;
        int t = 1;
        for(int i = 0; i + 1 < n; i += 2) {
            sol.push_back(i + t);
            t ^= 1;
        }
        t = 0;
        for(int i = 0; i + 1 < n; i += 2) {
            sol.push_back(i + t);
            t ^= 1;
        }
        return sol;
    }
}
