#include <iostream>
#include <cmath>
#include "partition.h"

std::vector<int> solve(std::vector<int> A)
{
    int total_sum = 0;
    for(auto i : A)
        total_sum+=i;
    int n = A.size();
    int s1 = 0, s2 = 0,p1=0,p2=0;
    std::vector<int> a,b;
    for(int i=0;i<n;i+=2)
    {
        int x = abs(A[i]-A[i+1]);
        if(s1<s2)
        {
            s1+=x;
            p1++;
            a.push_back(i);
        }
        else
        {
            p2++;
            s2+=x;
            b.push_back(i+1);
        }
    }
    if(n%2!=0)
    {
        if(s1<s2)
        {
            s1+=A[n-1];
            p1++;
        }
        else
        {
            s2+=A[n-1];
            p2++;
        }
    }
    if(s1<s2)
        return b;
    return a;
}
