Submission #1203550

#TimeUsernameProblemLanguageResultExecution timeMemory
1203550QuentolosseScales (IOI15_scales)C++20
55.56 / 100
1 ms328 KiB
#include "scales.h"

#include <bits/stdc++.h>

using namespace std;

void init(int T) {
    /* ... */
}

void orderCoins() {

    int W[6] = {0, 0, 0, 0, 0, 0};

    int min1 = getLightest(1, 2, 3);
    int min2 = getLightest(4, 5, 6);

    int autre = 6;
    if (autre == min2) autre = 5;

    int mini = getLightest(min1, min2, autre);

    W[0] = mini;
    if (mini > 3) {
        int a = 4, b = 5;
        if (mini == a) a = 6;
        if (mini == b) b = 6;

        W[1] = getLightest(min1, a, b);
    }
    else {
        int a = 1, b = 2;
        if (mini == a) a = 3;
        if (mini == b) b = 3;

        W[1] = getLightest(min2, a, b);
    }

    vector<int> restants;    
    for (int i = 1; i <= 6; i++)
    {
        if (W[0] != i && W[1] != i) {
            restants.push_back(i);
        }
    }

    mini = getLightest(restants[0], restants[1], restants[2]);
    autre = restants[0];
    if (mini == autre) autre = restants[1];    

    W[2] = getLightest(mini, autre, restants[3]);

    restants.clear();
    for (int i = 1; i <= 6; i++)
    {
        bool utilise = false;
        for (auto &&j : W)
        {
            if (i == j) {
                utilise = true;
            }
        }
        
        if (!utilise) {
            restants.push_back(i);
        }
    }

    W[3] = getLightest(restants[0], restants[1], restants[2]);
    W[4] = getMedian(restants[0], restants[1], restants[2]);

    for (int i = 1; i <= 6; i++)
    {
        bool utilise = false;
        for (auto &&j : W)
        {
            if (i == j) {
                utilise = true;
            }
        }
        
        if (!utilise) {
            W[5] = i;
            answer(W);
            return;
        }
    }

}
#Verdict Execution timeMemoryGrader output
Fetching results...