#include <bits/stdc++.h>
#include "partition.h"

using namespace std;

const int MAXN = 2e6;

struct date {
    int val, id;
};

date a[MAXN + 1];

bool by_val( date a, date b ) {
    return a.val < b.val;
}

std::vector<int> solve(std::vector<int> v) {
    int n = v.size();
    vector<int> rez;
    int i;
    for( i = 0; i < n; i++ )
        a[i] = { v[i], i };
    sort( a, a + n, by_val );
    rez.resize(n);
    int m = 0;
    if( n % 2 == 1 ) {
        for( i = 0; i < n; i += 2 )
            rez[m++] = a[i].id;
       for( i = 1; i < n; i += 2 )
            rez[m++] = a[i].id;
    } else {
        for( i = 1; i < n; i += 2 )
            rez[m++] = a[i].id;
        for( i = 0; i < n; i += 2 )
            rez[m++] = a[i].id;
    }
    return rez;
}

