#include "partition.h"
#include <iostream>
#include <algorithm>
#include <vector>
#include <algorithm>
using namespace std;
std::vector<int> solve(std::vector<int> A) {
    int n=A.size();
    reverse(A.begin(),A.end());
    vector <int> ras;
    int m=(n+1)/2;
    long long ss=0;
    for (int i=0;i<n;++i)
        ss=ss+A[i];
    long long sss=0;
    for (int i=0;i<m;++i)
        sss=sss+A[i];
    int ok=1;
    int ttt=m+n+1;
    for (int i=m;i<=ttt;++i)
    {
        sss+=A[i%n]-A[(i-m)%n];
        if (ss>2*sss) {ok=0;}
        else {
            if (ok==0)
            {
                int tt=i-m+1+n;
                for (int j=i-m+1;j<tt;++j)
                {
                    ras.push_back(n-j%n);
                }
                    return ras;
            }
        }
    }
    for (int j=0;j<n;++j)
        ras.push_back(n-j);
    return ras;
}