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