제출 #242864

#제출 시각아이디문제언어결과실행 시간메모리
242864godwind저울 (IOI15_scales)C++14
45.45 / 100
5 ms384 KiB
#include "scales.h"
#include <iostream>
#include <vector>
#include <algorithm>
#include <random>
#include <set>
#include <map>
#include <queue>
#include <cstring>
#include <cmath>
#include <bitset>
#include <iomanip>
#include <functional>

using namespace std;

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

int mex(int i, int j) {
    for (int x = 1; x <= 6; ++x) {
        if (x != i && x != j) {
            return x;
        }
    }
    return -1;
}

bool lss(int i, int j) {
    return getLightest(i, j, mex(i, j));
}

vector<int> proceed(int a, int b, int c) {
    int x = getLightest(a, b, c);
    int y = getMedian(a, b, c);
    int z = a + b + c - x - y;
    vector<int> v;
    v.emplace_back(x);
    v.emplace_back(y);
    v.emplace_back(z);
    return v;
}

void orderCoins() {
    /* ... */
    int W[] = {1, 2, 3, 4, 5, 6};
    vector<int> A = proceed(1, 3, 5);
    vector<int> B = proceed(2, 4, 6);
    vector<int> ans;
    int F = 0, S = 0;
    for (int it = 0; it < 6; ++it) {
        if (F == 3) {
            ans.emplace_back(B[S++]);
        } else if (S == 3) {
            ans.emplace_back(A[F++]);
        } else {
            int rest = -1;
            if (F + 1 < 3) rest = A[F + 1];
            if (S + 1 < 3) rest = B[S + 1];
            if (rest == -1) {
                rest = A[0];
                if (getMedian(A[F], B[S], rest) == A[F]) {
                    ans.emplace_back(A[F++]);
                } else {
                    ans.emplace_back(B[S++]);
                }
            } else {
                if (getLightest(A[F], B[S], rest) == A[F]) {
                    ans.emplace_back(A[F++]);
                } else {
                    ans.emplace_back(B[S++]);
                }
            }
        }
    }
    for (int i = 0; i < 6; ++i) W[i] = ans[i];
    answer(W);
}


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

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