#include "partition.h"
#include <algorithm>
using namespace std;
std::vector<int> solve(std::vector<int> A) {
    vector<bool> V(1e8, 0);
    int siz=A.size();
    vector<int> R1(siz);
    int sum1=0, sum2=0;

    int i=0, j=siz-1;
    for (int k=0; k<siz; k++) {
        if (k+1<siz) {
            if (A[k]>A[k+1]) {
                R1[i]=k;
                R1[j]=k+1;
                i++;
                j--;
            }
            else {
                R1[j]=k;
                R1[i]=k+1;
                i++;
                j--;
            }
            k++;
        }
        else {
            R1[i]=k;
            i++;
        }
    }

        return{R1};
}
