#include "partition.h"
#include <iostream>
#include <cassert>
#define pb push_back
std::vector<int> solve(std::vector<int> A) {
    int N = A.size();
    std::vector<int> rez(N);
    int val = 0;
    if((N & 1)){
        val = 1;
    }
    for(int i = 0;i<N;i++){
        if((i & 1)){
            rez[i] = ((N - i + N - val) % N);
        }else{
            rez[i] = i; // cele impare raman pe aceeasi pozitie
        }
    }
    for(int i = 0;i<N;i++){
        if(i == N / 2 && (((N / 2) % 2 != 0 && N % 2 == 0) ||(N % 2 == 1 && (N / 2) % 2 == 0))){
            int aux = rez[i - 1];
            rez[i - 1] = rez[i + 1];
            rez[i + 1] = aux;
        }
    }
    return {rez};
}
