답안 #914206

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
914206 2024-01-21T10:58:16 Z Itamar 저울 (IOI15_scales) C++14
컴파일 오류
0 ms 0 KB
void init(int T) {

}
#include "scales.h"
#include <vector>
using namespace std;
#define vi vector<int>

#include <set>
#include <algorithm>
void orderCoins() {
    vi v;
    v.push_back(getLightest(1, 2, 3));
    v.push_back(getMedian(1, 2, 3));
    v.push_back(v[0] ^ v[1]);
    for (int i = 4; i <= 6; i++) {
        vi vt;
        int an = getMedian(v[1], v[2], i);
        int in;
        if (an == i) {
            in = 2;
        }
        else if(an==v[1]) {
            int ant = getMedian(v[0], v[1], i);
            if (ant == v[0]) {
                in = 0;
            }
            else in = 1;
        }
        else {
            int ant = getMedian(v[i - 3], v[i - 2], i);
            if (ant == i)in = i - 2;
            else if (ant == v[i - 2])in = i - 1;
            else in = i - 3;
        }
        for (int j = 0; j < in; j++)vt.push_back(v[j]);
        vt.push_back(i);
        for (int j = in; j < i-1; j++)vt.push_back(v[j]);
        v = vt;
    }

    int c[6];
    for (int i = 0; i < 6; i++)c[i] = v[i];
    answer(c);
}

Compilation message

scales.cpp: In function 'void init(int)':
scales.cpp:1:15: warning: unused parameter 'T' [-Wunused-parameter]
    1 | void init(int T) {
      |           ~~~~^
In file included from scales.cpp:4:
scales.h: At global scope:
scales.h:8:6: error: conflicting declaration of 'void init(int)' with 'C' linkage
    8 | void init(int T);
      |      ^~~~
scales.cpp:1:6: note: previous declaration with 'C++' linkage
    1 | void init(int T) {
      |      ^~~~