제출 #713962

#제출 시각아이디문제언어결과실행 시간메모리
713962vjudge1저울 (IOI15_scales)C++17
컴파일 에러
0 ms0 KiB
#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);
}

컴파일 시 표준 에러 (stderr) 메시지

scales.cpp: In function 'void init(int)':
scales.cpp:5:15: warning: unused parameter 'T' [-Wunused-parameter]
    5 | void init(int T) {
      |           ~~~~^
scales.cpp: In function 'std::array<int, 3> order3(int, int, int)':
scales.cpp:10:20: error: 'getLightest' was not declared in this scope; did you mean 'lightest'?
   10 |     int lightest = getLightest(a, b, c);
      |                    ^~~~~~~~~~~
      |                    lightest
scales.cpp:11:15: error: 'getMedian' was not declared in this scope
   11 |     int med = getMedian(a, b, c);
      |               ^~~~~~~~~
scales.cpp: In function 'void orderCoins()':
scales.cpp:22:19: error: 'getLightest' was not declared in this scope
   22 |     int light34 = getLightest(p123[2], p456[0], p456[1]);
      |                   ^~~~~~~~~~~
scales.cpp:25:9: error: 'answer' was not declared in this scope
   25 |         answer(W);
      |         ^~~~~~
scales.cpp:32:9: error: 'answer' was not declared in this scope
   32 |         answer(W);
      |         ^~~~~~
scales.cpp:43:16: error: 'getMedian' was not declared in this scope
   43 |     int med1 = getMedian(p123[0], p123[1], p456[0]);
      |                ^~~~~~~~~
scales.cpp:66:5: error: 'answer' was not declared in this scope
   66 |     answer(W);
      |     ^~~~~~