제출 #286309

#제출 시각아이디문제언어결과실행 시간메모리
286309dolphingarlicScales (IOI15_scales)C++14
46.14 / 100
1 ms256 KiB
#include "scales.h"

#include <bits/stdc++.h>
using namespace std;

void init(int T) {}

void orderCoins() {
    deque<int> K;
    K.push_back(getLightest(1, 2, 3));
    K.push_back(getMedian(1, 2, 3));
    K.push_back(6 - K[0] - K[1]);

    // cout << "DEBUG\n";
    // for (int i : K) cout << i << ' ';
    // cout << '\n';

    int four_pos = getNextLightest(K[0], K[1], K[2], 4);
    if (four_pos == K[0]) {
        if (getLightest(K[0], K[1], 4) == 4) K.push_front(4);
        else K.push_back(4);
    } else K.insert(find(K.begin(), K.end(), four_pos), 4);

    // for (int i : K) cout << i << ' ';
    // cout << '\n';

    int five_pos = getNextLightest(K[1], K[2], K[3], 5);
    if (five_pos == K[1]) {
        int med = getMedian(K[0], K[1], 5);
        if (med == K[0]) K.push_front(5);
        else if (med == K[1]) K.push_back(5);
        else K.insert(K.begin() + 1, 5);
    } else K.insert(find(K.begin(), K.end(), five_pos), 5);

    // for (int i : K) cout << i << ' ';
    // cout << '\n';

    int six_pos = getNextLightest(K[2], K[3], K[4], 6);
    if (six_pos == K[2]) {
        int med = getMedian(K[1], K[2], 6);
        if (med == K[1]) {
            if (getLightest(K[0], K[1], 6) == 6) K.push_front(6);
            else K.insert(K.begin() + 1, 6);
        } else if (med == K[2]) K.push_back(6);
        else K.insert(K.begin() + 2, 6);
    } else K.insert(find(K.begin(), K.end(), six_pos), 6);

    // for (int i : K) cout << i << ' ';
    // cout << '\n';

    // cout << "END DEBUG\n";

    int W[6] = {K[0], K[1], K[2], K[3], K[4], K[5]};
    answer(W);
}

컴파일 시 표준 에러 (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...