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

std::vector<int> solve(std::vector<int> A) {
    std::cout<<(1<<25)<<"\n";
    int n = A.size();
    std::vector<int> res;
    std::vector<int> addLater;

    // std::vector<std::pair<int, int>> value_pos;
    // for(int i=0; i<n; i++){
    //     value_pos.push_back({A[i], i});
    // }
    // sort(value_pos.begin(), value_pos.end());
    int biggestInd = 0;
    for(int i=0; i<n; i++){
        if(A[i] > A[biggestInd]){
            biggestInd = i;
        }
    }
    // std::cout<<value_pos[0].first;
    
    // group 2
    int i = -1;
    while(res.size() < (n-1)/2){
        i++;
        if(i == biggestInd) {
            continue;
        }
        if(A[i] == A[biggestInd]){
            addLater.push_back(i);
            continue;
        }
        res.push_back(i);
    }
    res.push_back(biggestInd);
    for(int i=0; i<addLater.size(); i++){
        res.push_back(addLater[i]);
    }
    for(i+=1; i<n; i++){
        if(i != biggestInd) {
            res.push_back(i);
        }
    }
    
    
    // group 1
    // for(int i=0; i<n; i+=2){
    //     res.push_back(value_pos[i].second);
    // }
    // for(int i=1; i<n; i+=2){
    //     res.push_back(value_pos[i].second);
    // }
    return res;
}
/*
3
7
64 128 128 8 2 4 16
7
1 2 4 8 16 32 64
8
1 2 4 8 16 32 64 128
*/