Submission #1325361

#TimeUsernameProblemLanguageResultExecution timeMemory
1325361minh30082008Scales (IOI15_scales)C++20
0 / 100
0 ms332 KiB
#include "scales.h"
#include <algorithm>

bool heavier(int a, int b) {
    int c = 1;
    while (c == a || c == b) c++;
    int h = getHeaviest(a, b, c);
    return (h == a);
}
void init(int T) {
    return;
}

void orderCoins() {
    int w[6] = {1, 2, 3, 4, 5, 6};

    // bubble sort
    for (int i = 0; i < 6; i++) {
        for (int j = i + 1; j < 6; j++) {
            if (heavier(w[i], w[j])) {
                std::swap(w[i], w[j]);
            }
        }
    }

    answer(w);
}
#Verdict Execution timeMemoryGrader output
Fetching results...