Submission #752529

#TimeUsernameProblemLanguageResultExecution timeMemory
752529phoebeScales (IOI15_scales)C++17
0 / 100
1 ms220 KiB
#include <bits/stdc++.h>
#include "scales.h"
using namespace std;

void init(int t){
    // wat why do we need this?
}

void orderCoins(){
    // int h[6] = {0};
    // answer(h); return;
    int x[6];
    set<int> rem = {1, 2, 3, 4, 5, 6};
    int first_mx = getHeaviest(1, 2, 3);
    int second_mx = getHeaviest(4, 5, 6);
    x[2] = first_mx; x[5] = second_mx;
    rem.erase(first_mx); rem.erase(second_mx);
    int a = *rem.begin(), b = *(++rem.begin()), 
    c = *(++++rem.begin());
    int next_mx = getHeaviest(a, b, c);
    if (next_mx > 3) swap(x[2], x[5]);
    x[1] = next_mx;
    rem.erase(next_mx);
    a = *rem.begin(), b = *(++rem.begin()), 
    c = *(++++rem.begin());
    int global_mn = getLightest(a, b, c);
    x[3] = global_mn; rem.erase(global_mn);
    x[0] = *rem.begin(); x[4] = *(++rem.begin());
    vector<int> re;
    // x[0] > x[3]
    int cur = 3;
    for (int i = 0; i < 3; i++){
        int med = getNextLightest(x[3], x[4], x[5], x[i]);
        if (med == x[3]){ // all smaller than x[i]
            while (cur < 6) re.push_back(x[cur++]);
        }
        else{
            while (x[cur] != med) re.push_back(x[cur++]);
        }
        re.push_back(x[i]);
    }
    while (cur < 6) re.push_back(x[cur++]);
    int w[6]; for (int i = 0; i < 6; i++) w[i] = re[i];
    answer(w);
}

Compilation message (stderr)

scales.cpp: In function 'void init(int)':
scales.cpp:5:15: warning: unused parameter 't' [-Wunused-parameter]
    5 | void init(int t){
      |           ~~~~^
#Verdict Execution timeMemoryGrader output
Fetching results...