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

std::vector<int> solve(std::vector<int> A) {
    int n=A.size();
    vector<int> a=A;
    vector<int> ans(n);
    map<int,int> mp;
    int j=0;
    int o=n-1;
    for(int i=0;i<n;i++){
        if(i%4==0){
            ans[o]=i;
            o--;
        }
        else if(i%4==1){
            ans[j]=i;
            j++;
        }
        else if(i%4==2){
            ans[j]=i;
            j++;
        }
        else{
            ans[o]=i;
            o--;
        }
    }
    if(n==1)ans[0]=0;
    return ans;
}
