Submission #713964

#TimeUsernameProblemLanguageResultExecution timeMemory
713964vjudge1Scales (IOI15_scales)C++17
45.45 / 100
1 ms340 KiB
#include "scales.h"
#include <bits/stdc++.h>

using namespace std;

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

array<int, 3> order3(int a, int b, int c){
    int lightest = getLightest(a, b, c);
    int med = getMedian(a, b, c);
    int heaviest = a ^ b ^ c ^ lightest ^ med;

    return {lightest, med, heaviest};
}

void orderCoins() {
    //[1, 2, 3] va [4, 5, 6]
    array<int, 3> p123 = order3(1, 2, 3);
    array<int, 3> p456 = order3(4, 5, 6);

    int light34 = getLightest(p123[2], p456[0], p456[1]);
    if (light34 == p123[2]){
        int W[6] = {p123[0], p123[1], p123[2], p456[0], p456[1], p456[2]};
        answer(W);
        return;
    }

    int light16 = getLightest(p456[2], p123[0], p123[1]);
    if (light16 == p456[2]){
        int W[6] = {p456[0], p456[1], p456[2], p123[0], p123[1], p123[2]};
        answer(W);
        return;
    }

    int light25 = getLightest(p123[1], p456[1], p123[2]);
    if (light25 == p456[1]){
        //(1, 4, 5) (2, 3, 6)
        swap(p123, p456);
    }

    array<int, 3> p124, p356;
    int med1 = getMedian(p123[0], p123[1], p456[0]);
    if (med1 == p123[0]){
        p124 = {p456[0], p123[0], p123[1]};
    } else if (med1 == p123[1]){
        p124 = {p123[0], p123[1], p456[0]};
    } else {
        p124 = {p123[0], p456[0], p123[1]};
    }

    int med2 = getMedian(p123[2], p456[1], p456[2]);
    if (med2 == p456[1]){
        p356 = {p123[2], p456[1], p456[2]};
    } else if (med2 == p456[2]){
        p356 = {p456[1], p456[2], p123[2]};
    } else {
        p356 = {p456[1], p123[2], p456[2]};
    }

    int W[6] = {p124[0], p124[1], p124[2], p356[0], p356[1], p356[2]};

    //p456[0] < p123[2]
    //p123[0] < p456[2]

    answer(W);
}

Compilation message (stderr)

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