#include "partition.h"
#include <bits/stdc++.h>
using namespace std;

std::vector<int> solve(std::vector<int> a) {
    vector<int> ans;
#define int long long
    int n = a.size();
    int sum = n * (n + 1) / 2;
    int i = 1, cur = 0;
    while (i <= (n - 1) / 2 and cur < (sum + 1) / 2) {
        ans.push_back(i++);
        cur += i;
    }
    ans.push_back(n - 1);
    ans.push_back(0);
    while (ans.size() < n) {
        ans.push_back(i++);
    }
    return ans;
}