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

using namespace std;


vector<int> solve(vector<int> a) {

    priority_queue<int> q;
    for(int &i : a)q.push(i);

    int t = 1;
    vector<int> v, v2;
    while(q.size()) {
        auto x = q.top();
        q.pop();
        if(t)v.push_back(x);
        else v2.push_back(x);
        t^=1;
    }
    reverse(v.begin(), v.end());
    for(int &i : v2)v.push_back(i);
    return v;
}
